Hello. I have more than one nginx logs in folder which filebeat send to logstash and want to make index for each of them depends of the log name.
My logstash.conf looks like this:
input {
beats {
port => 5044
}
}
filter {
grok {
match => { "message" => "%{IP:remote_address} - \[%{HTTPDATE:timestamp}\] %{HOSTNAME:host} %{WORD:http_method} %{URIPATHPARAM:request} %{NOTSPACE:http_version} %{NUMBER:request_time} %{DATA:upstream_response_time} %{POSINT:request_length} %{POSINT:status} %{POSINT:bytes_sent} %{DATA:http_referer} \[%{GREEDYDATA:http_user_agent}\]" }
}
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
}
output {
elasticsearch {
hosts => "es01:9200"
ssl_enabled => true
cacert => "/usr/share/logstash/config/certs/ca/ca.crt"
user => "elastic"
password => "password"
index => "%.log"
}
stdout { codec => rubydebug }
}
What is the best way to reach the goal to send logs to different indexes depends of logs file name? Thx