Modify Logstash Elastic Agent output to accomodate for events with and without 'metadata.pipeline'

This commit is contained in:
Wes
2023-01-11 13:57:32 +00:00
parent caf0ea6b53
commit 5d86edeed4

View File

@@ -1,14 +1,28 @@
output {
if "elastic-agent" in [tags] and "import" not in [tags] {
elasticsearch {
hosts => "{{ GLOBALS.manager }}"
ecs_compatibility => v8
data_stream => true
user => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
ssl => true
ssl_certificate_verification => false
if [metadata][pipeline] {
elasticsearch {
hosts => "{{ GLOBALS.manager }}"
ecs_compatibility => v8
data_stream => true
user => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
pipeline => "%{[metadata][pipeline]}"
ssl => true
ssl_certificate_verification => false
}
}
else {
elasticsearch {
hosts => "{{ GLOBALS.manager }}"
ecs_compatibility => v8
data_stream => true
user => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
ssl => true
ssl_certificate_verification => false
}
}
}
}