Hi,
I have this configuration on 30-elasticsearch-output.conf
output {
elasticsearch {
hosts => ["localhost:9200"]
sniffing => true
manage_template => false
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
file {
path => "/tmp/log/Syslog_Server_Logs/%{host[name]}/%{host[name]}-%{+YYYY-MM-dd}.log"
codec => line { format => "%{source} - %{message}" }
}
}
My output files are something like my_servers_hostname-2018-06-18.log . I would like to have the application_name-date.log. How i can modify my file output to do this.??
My filter configuration is
filter {
if [type] == "syslog" {
grok {
match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:[%{POSINT:syslog_pid}])?: %{GREEDYDATA:syslog_message}" }
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
}
syslog_pri { }
date {
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
}
}
I saw that in the message the application name is related with the %{DATA:syslog_program}.
I changed the file path as
path => "/tmp/log/Syslog_Server_Logs/%{host[name]}/%{DATA:syslog_program}-%{+YYYY-MM-dd}.log"
but it didn't bring me the name of the application on the output .log file.
Do you have any idea on that?
I use elasticsearch 6.3 - kibana 6.3 - logstash 6.3.
Best Regards,
Thanos