# ES index date format for date/timezone offset

**URL:** <https://discuss.elastic.co/t/es-index-date-format-for-date-timezone-offset/285718>\
**Category:** Logstash\
**Created:** [October 2, 2021, 12:26am UTC](https://discuss.elastic.co/t/es-index-date-format-for-date-timezone-offset/285718 "2021-10-02T00:26:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![earlsanchez](https://avatars.discourse-cdn.com/v4/letter/e/b9e5f3/32.png) [@earlsanchez](https://discuss.elastic.co/u/earlsanchez)\
**Post date:** [October 2, 2021, 12:26am UTC](https://discuss.elastic.co/t/es-index-date-format-for-date-timezone-offset/285718/1 "2021-10-02T00:26:22Z")

</div>

Hello,  
We're using Elasticsearch v7.9.

The date format of our mongod logs changed to this:  
2021-09-26T03:23:46.515-0700

Now we're getting "\_dateparsefailure" during Logstash processing.

I can't find a specific example of how to handle the timezone offset, can someone please help?

Here is our ES index date format:

```auto
"format" : "MM/dd/yyyy HH:mm:ss||yyyy-MM-dd HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSS'Z'||yyyy-MM-dd HH:mm:ss,SSS||yyyy/MM/dd HH:mm:ss||yyyy-MM-dd'T'HH:mm:ss.SSSZZZ||yyyy-MM-dd||epoch_millis"

```

This is from our Logstash conf file to process the date from logs.

```auto
    grok {
      match => { "message" => "%{TIMESTAMP_ISO8601:date} %{WORD:severity} %{GREEDYDATA:message}" }
    }
    mutate { convert => ["severity","string"] }
    date {
	match => ["date", "yyyy-MM-dd'T'HH:mm:ss.SSSZZZ"]
	timezone => "America/Los_Angeles"
	target => "date"
    }
 

```

This is how Logstash is processing the date field:

```auto
"date" => "2021-09-26T03:23:46.515-0700",

```

TIA

---

<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:** [October 2, 2021, 1:06am UTC](https://discuss.elastic.co/t/es-index-date-format-for-date-timezone-offset/285718/2 "2021-10-02T01:06:10Z")

</div>

> [@earlsanchez](#):
>
> `"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ"`

Change ZZZ to ZZ. The target will then be a LogStash::Timestamp object which will be sent to elasticsearch as a number of milliseconds since the epoch (epoch\_millis).

---

<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:** [October 30, 2021, 1:06am UTC](https://discuss.elastic.co/t/es-index-date-format-for-date-timezone-offset/285718/3 "2021-10-30T01:06:18Z")

</div>

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