Please find my conf file. The filters works fine when used separate file but when combined they dont show the parsed fields in kibana.
input {
file {
path => "/var/log/messages"
start_position => "beginning"
type => "messages"
start_position => beginning
sincedb_path => "/dev/null"
ignore_older => 0
}
file {
path => "/var/log/chef-client.log"
type => "chef-client"
start_position => beginning
sincedb_path => "/dev/null"
ignore_older => 0
}
}
filter {
if [type] == "messages"{
grok {
match => {"message" => "%{SYSLOGTIMESTAMP:logtimeStamp} %{USERNAME:systemname} %{GREEDYDATA:message}"}
overwrite => [ "message"]
remove_field => ["@timestamp", "@version", "systemname" ]
}
mutate {
split => ["host", "."]
add_field => { "hostname" => "%{[host][0]}" }
add_field => { "podName" => "%{[host][1]}" }
add_field => { "ignore" => "%{[host][2]}" }
remove_field => ["ignore", "host"]
}
mutate {
split => ["path", "/"]
add_field => { "logfileName" => "%{[path][3]}" }
add_field => { "logPath" => "%{[path][2]}" }
remove_field => ["path", "logPath"]
}
if [type] == "chef-client" {
grok {
match => {"message" => "\[%{TIMESTAMP_ISO8601:logtimestamp}\] %{SPACE}%{LOGLEVEL:loglevel}:%{SPACE}%{GREEDYDATA:message}"}
overwrite => [ "message"]
remove_field => ["@timestamp", "@version" ]
}
mutate {
split => ["host", "."]
add_field => { "hostname" => "%{[host][0]}" }
add_field => { "podName" => "%{[host][1]}" }
add_field => { "ignore" => "%{[host][2]}" }
remove_field => ["ignore", "host"]
}
mutate {
split => ["path", "/"]
add_field => { "logfileName" => "%{[path][3]}" }
add_field => { "logPath" => "%{[path][2]}" }
remove_field => ["path", "logPath"]
}
}
if "_grokparsefailure" in [tags] {
drop { }
}
}
}
output {
amazon_es {
hosts => ["${ES_ENDPOINT}"]
region => "us-west-2"
index => "test-%{+YYYY.MM.dd}"
}
}