Logstash noob here, I am trying to get these log lines filtered through logstash.
2015-03-31 02:53:39 INFO This is info message 5
The config file that I am using is this:
input {
file {
path => "/sample/log4j_log.log"
start_position => beginning
}
}
filter {
grok {
match => [ "message" , "%{DATESTAMP:logtimestamp} %{LOGLEVEL:level} %{GREEDYDATA:msg}" ]
}
date {
locale => "en"
match => [ "logtimestamp" , "yyyy-MM-dd HH:mm:ss" ]
}
}
output {
#elasticsearch { host => localhost }
stdout { codec => rubydebug }
}
The output I get is
"message" => "2015-03-31 02:53:39 INFO This is info message 5",
"@version" => "1",
"@timestamp" => "0015-03-30T21:00:11.000Z",
"host" => "abc",
"path" => "/sample/log4j_log.log",
"logtimestamp" => "15-03-31 02:53:39",
"level" => "INFO",
"msg" => " This is info message 5"
I see that the logtimestamp field is showing the format as "YY-MM-dd HH:mm:ss", I am not sure why it is getting converted tot his format, and I even tried that in the date filter. IN those cases I get this output.
{
"message" => "2015-03-31 02:53:39 INFO This is info message 5",
"@version" => "1",
"@timestamp" => "2015-04-07T17:55:51.231Z",
"host" => "abc",
"path" => "/sample/log4j_log.log",
"logtimestamp" => "15-03-31 02:53:39",
"level" => "INFO",
"msg" => " This is info message 5"
}
In all of this the @timestamp is not matching up with the actual log event timestamp and this causes problems for elastic search + kibana visualization.
I have tried to include target => "@timestamp", locale => "en" as suggested by other questions on StackOverflow with no success.
The only thing I seem to not have tried is : Logstash date parsing as timestamp using the date filter Which i dont believe is fully applicable to my log event.