# Date filter is applying an extra hour to the timestamp

**URL:** https://discuss.elastic.co/t/date-filter-is-applying-an-extra-hour-to-the-timestamp/25524
**Category:** Logstash
**Created:** [July 14, 2015, 1:48pm UTC](https://discuss.elastic.co/t/date-filter-is-applying-an-extra-hour-to-the-timestamp/25524 "2015-07-14T13:48:42Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![DK\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dk_3/32/48003_2.png) [@DK\_3](https://discuss.elastic.co/u/DK_3)
#### Post date: [July 14, 2015, 1:48pm UTC](https://discuss.elastic.co/t/date-filter-is-applying-an-extra-hour-to-the-timestamp/25524/1 "2015-07-14T13:48:42Z")

</div>

It seems the locale or timezone I'm using for the date filter is applying an extra hour to the timestamp.  
The date filter is applied to the `log_timestamp` field and results in an extra hour applied:  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/6/683b2584c27d66bb07c595e4b6f516097d6df72a.png)

I've tried both of these date filters but +1 hr always gets added to @timestamp`

```
date {
    match => ["log_timestamp", "YYYY-MM-dd HH:mm:ss,SSS"]
    locale => "en"
}

date {
    match => ["log_timestamp", "YYYY-MM-dd HH:mm:ss,SSS ZZ"]
    locale => "en"
    timezone => "GMT+0"
}

```

I've also tried to manually set a timezone for the `log_timestamp` field  
`add_field => ["log_timestamp", "%{year}-%{month}-%{day} %{time},%{ms} +00:00"]`

How should I configure date filter so that the `log_timestamp` field and `@timestamp` match

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [July 14, 2015, 2:44pm UTC](https://discuss.elastic.co/t/date-filter-is-applying-an-extra-hour-to-the-timestamp/25524/2 "2015-07-14T14:44:47Z")

</div>

What timezone are you in, i.e. what timezone is "July 8th 2015, 14:01:31.013" in? And what's the actual value of the `@timestamp` field rather than the possibly timezone-adjusted field that Kibana displays? The Kibana interface should allow you to look at the source message. (And why do you have two date filters with different timezone settings?)

---

<div class="post-metadata">

### Author: ![DK\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dk_3/32/48003_2.png) [@DK\_3](https://discuss.elastic.co/u/DK_3)
#### Post date: [July 14, 2015, 3:57pm UTC](https://discuss.elastic.co/t/date-filter-is-applying-an-extra-hour-to-the-timestamp/25524/3 "2015-07-14T15:57:43Z")

</div>

Ah its the Kibana interface itself. I'm GMT+0100. Why is Kibana doing this?

So Kibana displays July 8th 2015, 14:04:24.418 however when I click into the JSON message I can see

"@timestamp": "2015-07-08T13:04:24.418Z",  
"log\_timestamp": "2015-07-08 13:04:24,418 +00:00"

NOTE I have only a single date filter. I just tried both versions to see if I could resolve this.

---

<div class="post-metadata">

### Author: ![DK\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dk_3/32/48003_2.png) [@DK\_3](https://discuss.elastic.co/u/DK_3)
#### Post date: [July 14, 2015, 4:40pm UTC](https://discuss.elastic.co/t/date-filter-is-applying-an-extra-hour-to-the-timestamp/25524/4 "2015-07-14T16:40:37Z")

</div>

It looks like a bug to me. The date filter does not add the timezone to the @timestamp field.

This date filter:

```
date {
    match => ["log_timestamp", "YYYY-MM-dd HH:mm:ss,SSSZ"]
    locale => "en"
    timezone => "GMT"
}

```

converts:  
`"log_timestamp": "2015-07-08 13:47:18,851+0000"`

to:  
`"@timestamp": "2015-07-08T13:47:18.851Z"`

And then Kibana will display the timestamp in its own timezone Z rather than the timezone of the original log statement provided by the field passed to the date filter.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [July 14, 2015, 4:59pm UTC](https://discuss.elastic.co/t/date-filter-is-applying-an-extra-hour-to-the-timestamp/25524/5 "2015-07-14T16:59:22Z")

</div>

The date filter does the right thing. The input timezone is UTC and the date filter always stores UTC in the `@timestamp` field so no adjustment is necessary. Kibana by default adjusts the UTC time to the local timezone for display purposes.

---

<div class="post-metadata">

### Author: ![Giovanii\_Mirko\_Terra](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@Giovanii\_Mirko\_Terra](https://discuss.elastic.co/u/Giovanii_Mirko_Terra)
#### Post date: [September 23, 2015, 2:16pm UTC](https://discuss.elastic.co/t/date-filter-is-applying-an-extra-hour-to-the-timestamp/25524/6 "2015-09-23T14:16:26Z")

</div>

What about if I am storing logs that were generated in different timezones? I agree all timestamps will be in UTC in my elasticsearch. However kibana will display the data based on my web browser timezone. Imagine now my web browser is in a completely different timezone, every time I see a dashboard I have to think where those logs where generated and make time-maths to catch the real time :(.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [September 23, 2015, 2:27pm UTC](https://discuss.elastic.co/t/date-filter-is-applying-an-extra-hour-to-the-timestamp/25524/7 "2015-09-23T14:27:47Z")

</div>

You always have the option of saving the original timestamp or original timezone.

No matter what choice is made here (always use UTC or use local timezones) there will be problematic use cases.

---

<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, 5:28am UTC](https://discuss.elastic.co/t/date-filter-is-applying-an-extra-hour-to-the-timestamp/25524/8 "2017-07-06T05:28:16Z")

</div>


