I have following logstash configuration for Websphere App server SystemErr logs.
As per the grok pattern, I do see the logs are getting parsed, but Overriding @timestamp is not working. I'm getting _dateparsefailure.
here is the configuration
input {
file {
path => ["/Path/System*.log"]
start_position => "beginning"
sincedb_path => "/Path/sincedbfile_WAS.txt"
codec => multiline {
pattern => "^\["
negate => true
what => "previous"
}
exclude => ["*.gz","native_std*.log"]
type => "WAS_logs"
tags => "WAS_logs"
}
}
filter{
grok {
patterns_dir => ["./appl/grokpattern"]
match => ["message", "\[%{TimeDate:WAS_TimeStamp}\] %{BASE16NUM:WAS_ThreadId} %{WORD:WAS_EventType}%{SPACE}%{WORD:WAS_LogLevel}%{SPACE}%{GREEDYDATA:WAS_LogMessage}"]
overwrite => [ "message" ]
}
date {
match => ["WAS_TimeStamp", "M/dd/YY HH:mm:ss:SSS ZZZ", "MM/d/YY HH:mm:ss:SSS ZZZ", "M/d/YY HH:mm:ss:SSS ZZZ", "MM/dd/YY H:mm:ss:SSS ZZZ", "M/d/YY H:mm:ss:SSS ZZZ", "MM/d/YY H:mm:ss:SSS ZZZ", "M/dd/YY H:mm:ss:SSS ZZZ"]
target => "@timestamp"
}
}
output {
elasticsearch {
hosts => ["HOST1:9200","HOST2:9200"]
index => "WAS-logs-%{+YYYY.MM.dd}"
}
file {
path => "/appl/logstash/LogStash_WAS_log_output.log"
}
}
I use custom patterns too.
TimeDate (?(%{DATE} %{TIME} %{TIMEZONE}))
DATE (?(\d{1,2}/\d{1,2}/\d{2}))
TIME (?(\d{1,2}:\d{1,2}:\d{1,2}:\d{1,3}))
TIMEZONE (?(\S{3}))
This is the log
[6/22/18 1:01:23:615 EDT] 00000078 SystemErr R at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:322)
below is the processed string by logstash
{
"TimeDate": "6/22/18 1:01:23:615 EDT",
"WAS_TimeStamp": "6/22/18 1:01:23:615 EDT"
"@timestamp": "2018-06-27T19:17:35.304Z",
"TIME": "1:01:23:615",
"WAS_EventType": "SystemErr",
"WAS_LogLevel": "R",
"host": "Host1",
"type": "WAS_logs",
"DATE": "6/22/18",
"tags": [
"WAS_logs",
"_dateparsefailure"
],
"WAS_LogMessage": "at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:322)\r",
"TIMEZONE": "EDT",
"message": "[6/22/18 1:01:23:615 EDT] 00000078 SystemErr R \tat org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:322)\r",
"@version": "1",
"path": "/appl/logfiles/SystemOut_Test.log",
"WAS_ThreadId": "00000078",
}
To me it looks like .. code wise everything is correct.
But not sure why @timestamp is not getting updated with WAS_TimeStamp.
Could you check what's wrong this config? Thanks in Advance.
Fredrick