# Timezone problem in ElasticSearch and Logstash

**URL:** <https://discuss.elastic.co/t/timezone-problem-in-elasticsearch-and-logstash/180163>\
**Category:** Logstash\
**Created:** [May 8, 2019, 11:20am UTC](https://discuss.elastic.co/t/timezone-problem-in-elasticsearch-and-logstash/180163 "2019-05-08T11:20:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ravindra\_Nath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravindra_nath/32/45153_2.png) [@Ravindra\_Nath](https://discuss.elastic.co/u/Ravindra_Nath)\
**Post date:** [May 8, 2019, 11:20am UTC](https://discuss.elastic.co/t/timezone-problem-in-elasticsearch-and-logstash/180163/1 "2019-05-08T11:20:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 8, 2019, 2:04pm UTC](https://discuss.elastic.co/t/timezone-problem-in-elasticsearch-and-logstash/180163/2 "2019-05-08T14:04:51Z")

</div>

Does [this](https://discuss.elastic.co/t/error-logstash-inputs-jdbc-unable-to-connect-to-database/177091/4) 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.

---

<div class="post-metadata">

**Author:** ![Ravindra\_Nath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravindra_nath/32/45153_2.png) [@Ravindra\_Nath](https://discuss.elastic.co/u/Ravindra_Nath)\
**Post date:** [May 9, 2019, 4:30am UTC](https://discuss.elastic.co/t/timezone-problem-in-elasticsearch-and-logstash/180163/3 "2019-05-09T04:30:59Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Ravindra\_Nath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravindra_nath/32/45153_2.png) [@Ravindra\_Nath](https://discuss.elastic.co/u/Ravindra_Nath)\
**Post date:** [May 9, 2019, 5:23am UTC](https://discuss.elastic.co/t/timezone-problem-in-elasticsearch-and-logstash/180163/4 "2019-05-09T05:23:51Z")

</div>

@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.

Thanks.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 9, 2019, 3:19pm UTC](https://discuss.elastic.co/t/timezone-problem-in-elasticsearch-and-logstash/180163/5 "2019-05-09T15:19:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 6, 2019, 3:19pm UTC](https://discuss.elastic.co/t/timezone-problem-in-elasticsearch-and-logstash/180163/6 "2019-06-06T15:19:54Z")

</div>

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