I am having problems viewing data of type date in kibana.
I am using an elk platform with the jdbc connector. Where to make the query I get date type information.
In the database I have the field loaded filled with 2020-02-02 17: 52: 48.8832020-02-02 17: 52: 48.883 the output I get has the value: loaded: 2020-02-02T16: 52: 48.883Z
I have tried unsuccessfully to change the format in different ways.
How could I do so that data output is exactly the content stored in the database?
elasticsearch saves timestamps as the number of milliseconds since the epoch, always in UTC. If I remember correctly elasticsearch will respond to queries with dates like 2020-02-02T16: 52: 48.883Z (where the Z indicates it is UTC).
kibana has a configurable date format and translates the date into the browsers local timezone by default.
I am not sure, but I think a jdbc input reading Date columns will assume them to be in the local timezone of the logstash server. logstash will convert the timestamp to UTC. If the DB and logstash are in different timezones you can control the timezone conversion on the connection string for some drivers (this drives the TZ that is input to logstash, not its output, which is always UTC).
Can you provide more detail on what your issue is and what your configuration is?
It sounds like the problem is that the jdbc input is converting the date to a timestamp, and you want it kept as a string. Try adding a CAST in the SELECT to force it to be a string.
I have posted about exact same case many time over and not a pretty good answer from anyone.
This is what I did. and working fine. I am in America/Chicago timezone.
Here is example. with submitted (date field)
filter {
mutate{
add_field => { "submitted_timezone" => "%{submitted}" }
}
date {
match => ["submitted", "dd-MMM-yy HH:mm", "ISO8601"]
target => "submitted"
}
date { match => ["submitted_timezone", "dd-MMM-yy HH:mm", "ISO8601"]
timezone => "Etc/UTC"
target => "submitted_timezone"
}
}
Here what I did is that, submitted is automatically handle by ELK. that means it is converted from current time to utc (added 6hour)
Then on kibana side it will be handled correctly via all visulization,
Make sure to setup timezone on kibana to America/Chicago
Now when I run a sql query (either via REST api or dev tool ) I use field submitted_timezone which is display as exact same time as I received from source.
I hope this make sense. I have spend countless hour to make sure it works.
If you just do last part and assign timezone your date will stay as is. But then it will show up 6+ hour on kibana (now time)
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.