# Logstash Failed to Parse Date (6 milliseconds)

**URL:** <https://discuss.elastic.co/t/logstash-failed-to-parse-date-6-milliseconds/299271>\
**Category:** Logstash\
**Created:** [March 10, 2022, 1:13am UTC](https://discuss.elastic.co/t/logstash-failed-to-parse-date-6-milliseconds/299271 "2022-03-10T01:13:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![userR](https://avatars.discourse-cdn.com/v4/letter/u/22d042/32.png) [@userR](https://discuss.elastic.co/u/userR)\
**Post date:** [March 10, 2022, 1:13am UTC](https://discuss.elastic.co/t/logstash-failed-to-parse-date-6-milliseconds/299271/1 "2022-03-10T01:13:29Z")

</div>

```auto
"reason"=>"failed to parse date field [Sun Feb 20 03:36:11.782065 2022] with format [strict_date_optional_time||epoch_millis]", "caused_by"=>{"type"=>"date_time_parse_exception", "reason"=>"Failed to parse with all enclosed parsers"}}}}}}

```

Since this datestamp has 6 miliseconds, I'm having trouble parsing it. Here is what I have in my logstash config:

```auto
    date {
      match => ["logdate", "dd/MMM/yyyy:HH:mm:ss Z", "EEE MMM dd HH:mm:ss.SSS yyyy"]
      target => "logdate"
    }

```

Below is the log format I used to try and parse a log with 6 milliseconds.

```auto
EEE MMM dd HH:mm:ss.SSS yyyy

```

I did read this thread ([How to read microseconds in grok like hh:mm:ss.SSSSSS](https://discuss.elastic.co/t/how-to-read-microseconds-in-grok-like-hh-mm-ss-ssssss/64792)) but am a little confused as hope I would mutate with gsub since this date stamp does not end with the milliseconds.

---

<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:** [March 10, 2022, 1:24am UTC](https://discuss.elastic.co/t/logstash-failed-to-parse-date-6-milliseconds/299271/2 "2022-03-10T01:24:43Z")

</div>

> [@userR](#):
>
> `EEE MMM dd HH:mm:ss.SSS yyyy`

Use `EEE MMM dd HH:mm:ss.SSSSSS yyyy` (even in 7.x). In 8.0 logstash supports microsecond precision. Some of the underlying classes support nanosecond precision, but not the date filter. A workaround to support nanosecond precise @timestamp values is described in [this](https://stackoverflow.com/questions/70783837/logstash-8-0-timestamp-with-nanoseconds-precision) SO post.

---

<div class="post-metadata">

**Author:** ![userR](https://avatars.discourse-cdn.com/v4/letter/u/22d042/32.png) [@userR](https://discuss.elastic.co/u/userR)\
**Post date:** [March 10, 2022, 4:08pm UTC](https://discuss.elastic.co/t/logstash-failed-to-parse-date-6-milliseconds/299271/3 "2022-03-10T16:08:19Z")

</div>

Hi Badger, I am running Logstash 8.0.0. To clarify, does the 8.0.0 date filter support microseconds?

---

<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:** [March 10, 2022, 4:21pm UTC](https://discuss.elastic.co/t/logstash-failed-to-parse-date-6-milliseconds/299271/4 "2022-03-10T16:21:46Z")

</div>

> [@userR](#):
>
> does the 8.0.0 date filter support microseconds?

That depends what you mean by "support".

```
input { generator { count => 1 lines => ['Sun Feb 20 03:36:11.782065 2022'] } }
filter {
    date { match => ["message", "EEE MMM dd HH:mm:ss.SSSSSS yyyy"] }
}

```

will result in

```
"@timestamp" => 2022-02-20T08:36:11.782Z,

```

So it can parse 6 digits of sub-second precision, but it will only use 3 of them.

---

<div class="post-metadata">

**Author:** ![userR](https://avatars.discourse-cdn.com/v4/letter/u/22d042/32.png) [@userR](https://discuss.elastic.co/u/userR)\
**Post date:** [March 10, 2022, 4:23pm UTC](https://discuss.elastic.co/t/logstash-failed-to-parse-date-6-milliseconds/299271/5 "2022-03-10T16:23:13Z")

</div>

Perfect, microsecond precision isn't needed. Thanks you!

---

<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:** [April 7, 2022, 4:23pm UTC](https://discuss.elastic.co/t/logstash-failed-to-parse-date-6-milliseconds/299271/6 "2022-04-07T16:23:38Z")

</div>

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