Hi! I am trying to parse the following date format:
2022-03-03 10:45:02,520
My current configuration for logstash to parse is:
grok {
match => [
"message", "%{TIMESTAMP_ISO8601:logdate}....."
]
}
date {
match => ["logdate", "YYYY-MM-dd HH:mm:ss,SSS"]
target => "logdate"
}
However, when I view the logs on Kibana, I see the following logdate:
Mar 3, 2022 @ 02:45:02.520
The hour field seems to be parsing incorrectly. I noticed on my grok debugger that TIMESTAMP_ISO8601 parses the hour incorrectly but that shouldn't matter with my date pluggin right?
If you do not use the timezone option on the date filter it will parse assuming the field is in the logstash servers local timezone. The parsed time stored in Elasticsearch is always UTC.
Kibana will, by default, adjust the date to be in the browser's timezone.
It looks like Kibana is displaying the date in UTC. In the advanced options of Kibana there is a dateFormat:tz option that controls what timezone it uses.
I modified that field from "Browser" to US/Pacific". The logdate still seems to show the UTC time. I refreshed my browser, re-created Data Views and logged out and back in with no change.
So logdate exactly matches the start of [event][original]. That suggests that the date filter parser set the timezone to UTC. It is documented as using the system default timezone if the option is not set.
I think I'm starting to understand. So I'll need to specify the time zone in my logstash config file. And since the server that it's reading logs from is MST, I'll need to specify
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.