Hi! I'd like to send a hostname and some other host metadata from filebeat to Logstash. Then Logstash saves files with a name like:
Summary
file {
path => "~/%{+YYYY-MM-dd}/%{component}/%{[@metadata][host]:[name]}-%{log_name}-%{+HH}.00.log.gz"
codec => line { format => "%{message}"}
file_mode => 0644
gzip => true }
But Logstash can't parse this path, it saves a file like: ~/2019-08-06/app/%{[@metadata][host]:[name]}-weblogic-14.00.log.gz
I've tried a lot of different combinations of {, @,[ and " . Where am I wrong? Part of my Filebeat configuration:
Also I tried - add_host_metadata: ~
What does tilde mean?
Of course, I can add a hostname in fields, but I'll have several paths and many servers so I don't want to enumerate each field in every path block.
Can anyone help, please!?
It was a bit hard to parse the output of journalctl, so it might not work. But I think you need to change the path to "~/%{+YYYY-MM-dd}/%{component}/%{[host]:[name]}-%{log_name}-%{+HH}.00.log.gz", as the event contains host.name on the top level of the fields.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.