Correct community beats index

Community beats sometimes lack all of the assumed metadata that a core
beat would contain by default. This change will check if a beat has the
version metadata before assuming it does, which is commonly not found on
community beats (journalbeat).

Change-Id: I64adf5ff7c810a593b9fc2d0f306cfd4bda6632d
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-06-15 18:12:02 -05:00
parent 8ce7794be9
commit a1887b5cc9

View File

@ -1,8 +1,17 @@
output {
if [@metadata][version] {
elasticsearch {
hosts => {{ elasticsearch_data_hosts | shuffle(seed=inventory_hostname) | to_json }}
sniffing => {{ (not data_node | bool) | lower }}
manage_template => {{ (data_node | bool) | lower }}
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
}
} else {
elasticsearch {
hosts => {{ elasticsearch_data_hosts | shuffle(seed=inventory_hostname) | to_json }}
sniffing => {{ (not data_node | bool) | lower }}
manage_template => {{ (data_node | bool) | lower }}
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
}
}
}