# Logstash JDBC input plugin - Set database date data timezone

**URL:** <https://discuss.elastic.co/t/logstash-jdbc-input-plugin-set-database-date-data-timezone/35672>\
**Category:** Logstash\
**Created:** [November 26, 2015, 1:27pm UTC](https://discuss.elastic.co/t/logstash-jdbc-input-plugin-set-database-date-data-timezone/35672 "2015-11-26T13:27:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![razafinr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/razafinr/32/45334_2.png) [@razafinr](https://discuss.elastic.co/u/razafinr)\
**Post date:** [November 26, 2015, 1:27pm UTC](https://discuss.elastic.co/t/logstash-jdbc-input-plugin-set-database-date-data-timezone/35672/1 "2015-11-26T13:27:31Z")

</div>

I am using the logstash JDBC plugin to retrieve data from my SQL database to Elasticsearch.

It is working fine except I have the following problem:

I am storing my dates in UTC timezone in my database but when I use logstash, the dates are retrieved using the timezone of my machine.

I didn't see in the documentation how to set the timezone of the retrieved data or how to set Logstash to use UTC as local timezone.

Can anyone help ?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 27, 2015, 6:45am UTC](https://discuss.elastic.co/t/logstash-jdbc-input-plugin-set-database-date-data-timezone/35672/2 "2015-11-27T06:45:48Z")

</div>

Use the date filter so LS knows 🙂

---

<div class="post-metadata">

**Author:** ![razafinr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/razafinr/32/45334_2.png) [@razafinr](https://discuss.elastic.co/u/razafinr)\
**Post date:** [November 27, 2015, 2:22pm UTC](https://discuss.elastic.co/t/logstash-jdbc-input-plugin-set-database-date-data-timezone/35672/3 "2015-11-27T14:22:24Z")

</div>

Yes this is a solution but it seems realy painful for me to apply this, as the dates are retrieved as Ruby date object from database and I can not apply directly the date filter on them, I have to convert all the dates to VARCHAR when getting them from database then apply a filter on each of my date variable to make it works.

---

<div class="post-metadata">

**Author:** ![Gene](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@Gene](https://discuss.elastic.co/u/Gene)\
**Post date:** [May 25, 2016, 5:03am UTC](https://discuss.elastic.co/t/logstash-jdbc-input-plugin-set-database-date-data-timezone/35672/4 "2016-05-25T05:03:17Z")

</div>

define jdbc\_default\_timezone =\> "UTC" in jdbc input plugin

---

<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:** [July 6, 2017, 4:56am UTC](https://discuss.elastic.co/t/logstash-jdbc-input-plugin-set-database-date-data-timezone/35672/5 "2017-07-06T04:56:22Z")

</div>


