Skip to content

Commit a5c88d4

Browse files
committed
Fixed syntax for syntax check
TIL: * Logstash can read YAML. Logstash config check CAN NOT. * Logstash documentation lists per-pipeline and global options in the same list. Config check does not allow to mix them * Sometimes it just sucks to be alive Damn, that cost a lot of time and local debugging in test hosts.
1 parent e18849d commit a5c88d4

File tree

6 files changed

+17
-30
lines changed

6 files changed

+17
-30
lines changed

docs/logstash-pipelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Every Output can have a `congestion:` option with a numerical value. If the Redi
205205

206206
### Unsafe shutdown ###
207207

208-
If you need unsafe Logstash shutdowns, e.g. for testing, you can set `logstash_pipeline_unsafe_shutdown` to `true`. If you want better controll over which pipeline is allowed to shutdown unsafely, there are `ansible_input_unsafe_shutdown`and `ansible_forwarder_unsafe_shutdown` for default pipelines. And every pipeline has it's own `unsafe_shutdown` setting. All three default to the value of `logstash_pipeline_unsafe_shutdown` which by itself defaults to `false`.
208+
If you need unsafe Logstash shutdowns, e.g. for testing, you can set `logstash_pipeline_unsafe_shutdown` to `true`. The variable doesn't have a default so Logstash falls back to its internal default of `false`.
209209

210210
## Caveats ##
211211

molecule/elasticstack_default/converge.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
elasticsearch_heap: "2"
1717
elasticstack_full_stack: true
1818
logstash_pipeline_unsafe_shutdown: true
19+
logstash_password_hash: false
1920
beats_filebeat_syslog_udp: true
2021
beats_filebeat_syslog_tcp: true
2122
beats_filebeat_modules:

molecule/elasticstack_default/verify.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
elasticstack_initial_passwords: /usr/share/elasticsearch/initial_passwords
88
tasks:
99

10-
- name: Give some time for tools to connect
11-
ansible.builtin.wait_for:
12-
timeout: 120
13-
1410
- name: Run Logstash syntax check
1511
ansible.builtin.command: "/usr/share/logstash/bin/logstash --path.settings=/etc/logstash -t"
1612
when: "'logstash' in group_names"

roles/logstash/defaults/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ logstash_config_path_logs: /var/log/logstash
1717
# pipeline configuration #
1818
logstash_manage_pipelines: true
1919
logstash_queue_type: persisted
20-
logstash_pipeline_unsafe_shutdown: false
2120

2221
# this will deactivate all pipeline management
2322
logstash_no_pipelines: false

roles/logstash/templates/logstash.yml.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ http.port: {{ logstash_http_port }}
1313
{% if logstash_global_ecs is defined %}
1414
pipeline.ecs_compatibility: {{ logstash_global_ecs }}
1515
{% endif %}
16+
{% if pipeline.unsafe_shutdown is defined %}
17+
pipeline.unsafe_shutdown: {{ logstash_pipeline_unsafe_shutdown }}
18+
{% endif %}
1619
{% if logstash_legacy_monitoring | bool and elasticstack_full_stack | bool and elasticstack_variant == "elastic" and elasticstack_release | int < 8 %}
1720
xpack.monitoring.enabled: true
1821
xpack.monitoring.elasticsearch.hosts: [ {% for host in logstash_elasticsearch %}"https://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %} ]

roles/logstash/templates/pipelines.yml.j2

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,21 @@
1919
# Default beat input #
2020
# Autoconfigured Redis outputs: input
2121

22-
- pipeline:
23-
id: ansible-input
24-
unsafe_shutdown: {{ ansible_input_unsafe_shutdown | default( logstash_pipeline_unsafe_shutdown ) }}
25-
path:
26-
config: "/etc/logstash/conf.d/ansible-input/*.conf"
27-
queue:
28-
type: {{ logstash_input_queue_type }}
29-
max_bytes: {{ logstash_input_queue_max_bytes }}
22+
- pipeline.id: ansible-input
23+
path.config: "/etc/logstash/conf.d/ansible-input/*.conf"
24+
queue.type: {{ logstash_input_queue_type }}
25+
queue.max_bytes: {{ logstash_input_queue_max_bytes }}
3026

3127
{% endif %}
3228
{% if logstash_elasticsearch_output | bool %}
3329

3430
# Default elasticsearch output #
3531
# Autoconfigured Redis input: forwarder
3632

37-
- pipeline:
38-
id: ansible-forwarder
39-
unsafe_shutdown: {{ ansible_forwarder_unsafe_shutdown | default( logstash_pipeline_unsafe_shutdown ) }}
40-
path:
41-
config: "/etc/logstash/conf.d/ansible-forwarder/*.conf"
42-
queue:
43-
type: {{ logstash_forwarder_queue_type }}
44-
max_bytes: {{ logstash_forwarder_queue_max_bytes }}
33+
- pipeline.id: ansible-forwarder
34+
path.config: "/etc/logstash/conf.d/ansible-forwarder/*.conf"
35+
queue.type: {{ logstash_forwarder_queue_type }}
36+
queue.max_bytes: {{ logstash_forwarder_queue_max_bytes }}
4537

4638
{% endif %}
4739
{% if logstash_pipelines is defined %}
@@ -72,14 +64,10 @@
7264

7365
{% endif %}
7466

75-
- pipeline:
76-
id: {{ item.name }}
77-
unsafe_shutdown: {{ item.unsafe_shutdown | default( logstash_pipeline_unsafe_shutdown ) }}
78-
path:
79-
config: "/etc/logstash/conf.d/{{ item.name }}/*.conf"
80-
queue:
81-
type: {{ item.queue_type | default('memory') }}
82-
max_bytes: {{ item.queue_max_bytes | default('1gb') }}
67+
- pipeline.id: {{ item.name }}
68+
path.config: "/etc/logstash/conf.d/{{ item.name }}/*.conf"
69+
queue.type: {{ item.queue_type | default('memory') }}
70+
queue.max_bytes: {{ item.queue_max_bytes | default('1gb') }}
8371

8472
{% endfor %}
8573
{% endif %}

0 commit comments

Comments
 (0)