Sidehistorik
...
Kodeblok | ||
---|---|---|
| ||
output { if [type] == "pinglog" { elasticsearch { hosts => ["localhost:9200"] sniffing => true manage_template => false index => "pinglog-%{+YYYY.MM.dd}" document_type => "%{[@metadata][type]}" } } else { if [type] == "camlog" { elasticsearch { hosts => ["localhost:9200"] sniffing => true manage_template => false index => "camlog-%{+YYYY.MM.dd}" document_type => "%{[@metadata][type]}" } } else { elasticsearch { hosts => ["localhost:9200"] sniffing => true manage_template => false index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}" document_type => "%{[@metadata][type]}" } } } } |
Test and restart:
Kodeblok |
---|
root@elkserver:/etc/logstash/conf.d# /etc/init.d/logstash configtest
Configuration OK
root@elkserver:/etc/logstash/conf.d# /etc/init.d/logstash restart
Killing logstash (pid 16262) with SIGTERM
Waiting logstash (pid 16262) to die...
Waiting logstash (pid 16262) to die...
Waiting logstash (pid 16262) to die...
Waiting logstash (pid 16262) to die...
logstash stopped.
logstash started.
root@elkserver:/etc/logstash/conf.d# |
As I have ensured logs are pretty much key=value for the values I need to collect, I use kv to get the fields, and a mutate to ensure the string value for "pingtime=" becomes a float (otherwise it cant be used in a Visualization):
...