Timezone problem in ElasticSearch and Logstash

I have a DATETIME field in MySQL database table. I am dumping that table data to Elastic Search through logstash. When the data is being loaded into elastic search the time field(DATETIME type) of the log is changing. And if i search it in the dev console of kibana, the time field is displayed with the changed time.

Does this help?

Timestamps are stored in elasticsearch as UTC. logstash will assume your dates are in your local timezone. If your MySQL server is not in your local timezone you will need to tell logstash (or jdbc) that.

@Badger Can you please elaborate more on this and explain me with code how to do it in the logstash because i am new to ELK.

@Badger The thing is i am using JAVA High Level Rest Client to access the elastic search and i am performing a range query and the time returned in the response is in UTC timezone but i want to define my own timezone for that query.


As I said, elasticsearch stores data with UTC timestamps. I believe the client (i.e. your code) is expected to map that to the local timezone. You might get an answer to that question in the elasticsearch forum.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.