This is my sample log line
2021-06-28 10:25:29.537695 traceID=d283c222257e0e92ba97269a5f780d81 spanID=f46645e821cb4dab A4 LG 4 Logger.cpp:250 - Configuring log file: /home/rxm/log/latest/2021-06-28-102529-log-%3N.log Archival path: /home/rxm/log/latest/
2021-06-28 10:25:29.537837 traceID=d283c222257e0e92ba97269a5f780d81 spanID=f46645e821cb4dab A4 LG 5 RxBaseNode.cpp:4475 - Log root folder: ---------- /home/rxm/log/latest/
2021-06-28 10:25:29.537861 traceID=d283c222257e0e92ba97269a5f780d81 spanID=f46645e821cb4dab A4 LG 6 RxBaseNode.cpp:450 - Configuration root folder:- /home/rxm/config/
And this is my Config.
filter {
grok {
match => {
"message" => "%{DATESTAMP:logdate} traceID=%{WORD:traceID} spanID=%{WORD:spanID} %{GREEDYDATA:msg}"
}
}
date {
match => [ "logdate" , "yyyy-MM-dd HH:mm:ss.SSSSSS" ]
target => "@timestamp"
}
}
But the date filter is parsing the log date incorrectly as
2022-02-10T17:48:36.964Z
Here is the output
{
"@version" => "1",
"@timestamp" => 0021-06-28T04:32:01.537Z,
"host" => "LTM-PKRISHNAN.Dlink",
"type" => "newapiserver",
"spanID" => "f46645e821cb4dab",
"message" => "2021-06-28 10:25:29.537 traceID=d283c222257e0e92ba97269a5f780d81 spanID=f46645e821cb4dab A4 LG 6 RxBaseNode.cpp:450 - Configuration root folder:- /home/rxm/config/",
"path" => "/Users/pkrishnan/Node-Apps/my-node-example/logs/newapiserver.log",
"logdate" => "21-06-28 10:25:29.537",
"msg" => "A4 LG 6 RxBaseNode.cpp:450 - Configuration root folder:- /home/rxm/config/",
"traceID" => "d283c222257e0e92ba97269a5f780d81"
}
Why is the timestamp having a date in which I get 0021 for the year instead of 2021. This is puzzling