# Logstash jdbc\_default\_timezone issue (bug)

**URL:** <https://discuss.elastic.co/t/logstash-jdbc-default-timezone-issue-bug/97578>\
**Category:** Logstash\
**Created:** [August 18, 2017, 12:35pm UTC](https://discuss.elastic.co/t/logstash-jdbc-default-timezone-issue-bug/97578 "2017-08-18T12:35:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bterhorst](https://avatars.discourse-cdn.com/v4/letter/b/c57346/32.png) [@bterhorst](https://discuss.elastic.co/u/bterhorst)\
**Post date:** [August 18, 2017, 12:35pm UTC](https://discuss.elastic.co/t/logstash-jdbc-default-timezone-issue-bug/97578/1 "2017-08-18T12:35:58Z")

</div>

Hi,

I am using the logstash jdbc input but have problems using the jdbc\_default\_timezone.  
The database I use has timezone Europe/Amsterdam so I thought if I set that as de defaut timezone it would work like a charm.

```
jdbc {
        #here are the connection stuff for oracle
        
        statement => "SELECT COL_1 DATE_TIME_COL FROM TABLE WHERE DATE_TIME_COL > :sql_last_value

        schedule => "* * * * *"
		clean_run => "false"
		record_last_run => "true"
		last_run_metadata_path => "C:\dev\elk\logstash-5.4.0\filepath\test"
		tracking_column_type => "timestamp"
		jdbc_default_timezone => "Europe/Amsterdam"
     }

```

I have a record a table with DATE\_TIME\_COL 2017-08-19 12:19:00.123000

In the logging of logstash I see the following appended for sql\_last\_value.  
When using Europe/Amsterdam: DATE\_TIME\_COL \> `TIMESTAMP '2017-08-18 14:18:00.123000 +02:00'`  
When I comment out the jdbc\_default\_timezone: DATE\_TIME\_COL \> `TIMESTAMP '2017-08-18 12:18:00.276000 +00:00'`

When I copy-paste the generated sql and execute that in oracle I do not get any results.

In the case where I use timezone Europe/Amsterdam and I edit the sql and set the hours back two hours to `12:18` I get the expected result.  
In the case where I commented out the jdbc\_default\_timezone, and I edit the sql and set the hours back two hours to `10:18` I get the expected result.

Any ideas where I am going wrong?

Regards Benny

---

<div class="post-metadata">

**Author:** ![bterhorst](https://avatars.discourse-cdn.com/v4/letter/b/c57346/32.png) [@bterhorst](https://discuss.elastic.co/u/bterhorst)\
**Post date:** [August 18, 2017, 3:26pm UTC](https://discuss.elastic.co/t/logstash-jdbc-default-timezone-issue-bug/97578/2 "2017-08-18T15:26:47Z")

</div>

Is it not that logstash is giving back the wrong time?

Timezone Europe/Amsterdam is UTC + 2 hours.

If UTC time as defined in this example is 12:18 then it should be replacing `last_sql_value` with: `TIMESTAMP '2017-08-18 12:18:00.276000 +02:00'` instead of `TIMESTAMP '2017-08-18 14:18:00.123000 +02:00'`

A workaround to this issue, _if it is an issue_, would be to subtract +2:00: `WHERE DATE_TIME_COL > :sql_last_value - 2/24`

Regards benny

---

<div class="post-metadata">

**Author:** ![bterhorst](https://avatars.discourse-cdn.com/v4/letter/b/c57346/32.png) [@bterhorst](https://discuss.elastic.co/u/bterhorst)\
**Post date:** [August 21, 2017, 12:24pm UTC](https://discuss.elastic.co/t/logstash-jdbc-default-timezone-issue-bug/97578/3 "2017-08-21T12:24:38Z")

</div>

Please let me know if I'm jumping to wrong conclusions with my workaround!

Regards

---

<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:** [September 18, 2017, 12:24pm UTC](https://discuss.elastic.co/t/logstash-jdbc-default-timezone-issue-bug/97578/4 "2017-09-18T12:24:39Z")

</div>

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