Skip to content

Commit 3992988

Browse files
authored
Fix system tests using logstash for ingest only write one event per data stream (#2117)
1 parent 124778e commit 3992988

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

internal/stack/_static/logstash.conf.tmpl

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,26 @@ filter {
2121
}
2222

2323
output {
24-
elasticsearch {
25-
hosts => ["{{ $elasticsearch_host }}"]
26-
user => '{{ fact "username" }}'
27-
password => '{{ fact "password" }}'
28-
ssl_enabled => true
29-
{{- if eq $elasticsearch_host "https://elasticsearch:9200" }}
30-
ssl_certificate_authorities => "/usr/share/logstash/config/certs/ca-cert.pem"
31-
document_id => "%{[@metadata][_ingest_document][id]}"
32-
{{- end }}
24+
if [@metadata][_ingest_document][id] {
25+
elasticsearch {
26+
hosts => ["{{ $elasticsearch_host }}"]
27+
user => '{{ fact "username" }}'
28+
password => '{{ fact "password" }}'
29+
ssl_enabled => true
30+
{{- if eq $elasticsearch_host "https://elasticsearch:9200" }}
31+
ssl_certificate_authorities => "/usr/share/logstash/config/certs/ca-cert.pem"
32+
document_id => "%{[@metadata][_ingest_document][id]}"
33+
{{- end }}
34+
}
35+
} else {
36+
elasticsearch {
37+
hosts => ["{{ $elasticsearch_host }}"]
38+
user => '{{ fact "username" }}'
39+
password => '{{ fact "password" }}'
40+
ssl_enabled => true
41+
{{- if eq $elasticsearch_host "https://elasticsearch:9200" }}
42+
ssl_certificate_authorities => "/usr/share/logstash/config/certs/ca-cert.pem"
43+
{{- end }}
44+
}
3345
}
3446
}

0 commit comments

Comments
 (0)