When I created the index in kibana I mapped the field "data" to the field "time".
in Kibana I have the following output :
"time" : April 3rd 2017, 09:21:39.092
"data" : April 3rd 2017, 09:21:39.092
"@timestamp" : April 18th 2017, 14:41:32.042
"message": 2017-04-03 07:21:39,092
My current configured time zone in my operating system is a UTC+2.
I configured kibana to have the dateformat:tz to Africa/Maputo(my current timezone)
, but the problem persist.
so I changed the dateformat:tz to ETC/UTC . it solved the problem, but don't seems to be the best way to configure it.
Is there any way to keep the dateformat:tz with the correct country ?
What's the timezone for the original timestamp in the message field? Right now it includes no timezone information so Elasticsearch will assume it is in UTC. When Kibana gets the date in UTC it adds two hours to account for your local timezone. If you want message, data, and time to all match you'll need to add the timezone to the message field before indexing your documents into elasticsearch.
Personally I would try to fix it in the application that's generating the logs so that the time is always correct no matter how you end up using the logs. However you could also use the Logstash date filter to parse the date and add the appropriate timezone.
For each hit in the response you'll see a fields key with the time field and its value. Compare this value to the value you see in _source in the same document.
What does the _source value look like, and what does the doc_value look like? If the timezone was set correctly, the doc_value should be 2 hours behind the _source value because the doc_value is in UTC whereas the _source value is in Africa/Maputo.
If this looks correct, we can move on to Kibana and see what's happening there.
Ok, that mostly looks correct to me. Data is in Africa/Maputo timezone which is UTC+02:00. @timestamp is in UTC so it is two hours behind Data. The only remaining problem is that the raw Data field still doesn't specify its timezone, so elasticsearch is going to assume it's UTC.
I would just add an additional date filter to your logstash config to convert the Data field itself e.g.
date {
match => [ "Data", "ISO8601" ]
timezone => "Africa/Maputo"
target => "Data"
}
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.