Use id for doc id if it exists

This commit is contained in:
Josh Brower
2021-12-09 09:16:58 -05:00
parent 892899b7f9
commit 656ea974dc

View File

@@ -7,6 +7,23 @@
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:pass', '') %}
output {
if "beat-ext" in [tags] and "import" not in [tags] and "filebeat" not in [metadata][pipeline] {
if [metadata][_id] {
elasticsearch {
pipeline => "beats.common"
hosts => "{{ ES }}"
{% if salt['pillar.get']('elasticsearch:auth:enabled') is sameas true %}
user => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
{% endif %}
index => "so-beats"
template_name => "so-beats"
template => "/templates/so-beats-template.json"
template_overwrite => true
ssl => true
ssl_certificate_verification => false
document_id => "%{[metadata][_id]}"
}
} else {
elasticsearch {
pipeline => "beats.common"
hosts => "{{ ES }}"
@@ -23,3 +40,4 @@ output {
}
}
}
}