Hello, I'm trying to read input from JDBC and applied date filter but logstash logs is one hour ahead the actual date. I don't where this difference came from.
But actually the current time stamp is 2 PM so the logging is ahead by one hour.
Really spent much time to figure where this difference came from with no luck.
Thanks in advance for your help.
Thanks Badger for your reply.
I tried all the below with no luck:
date {
match => [ "rec_time", "MMM D, YYYY @ HH:mm:ss.SSS" ]
timezone => "EET" ### timestamp still ahead by one hour
# timezone => "UTC" ### timestamp still ahead by one hour
# timezone => "Africa/Cairo" ### timestamp still ahead by one hour
# timezone => "UTC-1" ### gives error
target => ["@timestamp"]
}
OK, so when the jdbc sets [rec_time] it is setting it to UTC. Note that there are no quotes around the value of rec_time, so the input has converted it to a Logstash::Timestamp. It is not a string so the date filter cannot parse it.
You could
mutate { convert => { "rec_time" => "string" } }
and the date filter would be able to parse it. The timezone option will be ignored because that trailing Z on the value of [rec_time] says it is already UTC.
You should not have to set the timezone option, but if you decide you need to you can
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.