# Unable to parse this timestamp-very strange

**URL:** <https://discuss.elastic.co/t/unable-to-parse-this-timestamp-very-strange/163903>\
**Category:** Logstash\
**Created:** [January 11, 2019, 1:38pm UTC](https://discuss.elastic.co/t/unable-to-parse-this-timestamp-very-strange/163903 "2019-01-11T13:38:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nithani25](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nithani25/32/33457_2.png) [@Nithani25](https://discuss.elastic.co/u/Nithani25)\
**Post date:** [January 11, 2019, 1:38pm UTC](https://discuss.elastic.co/t/unable-to-parse-this-timestamp-very-strange/163903/1 "2019-01-11T13:38:00Z")

</div>

Hi Team,  
I am working two sets of logs, with different timestamp files and i am not able to parse them

Format 1: 2018-Dec-18 08:18:21,531

Logstash conf

```
match => { "message" => "%{YEAR:year}-%{MONTH:month}-%{MONTHDAY:day} %{TIME:time},%{NUMBER:z}" }
       overwrite => ["message"]
            }
       mutate {
          add_field => { "timestamp" => "%{year}-%{month}-%{day} %{time},%{z}" }
             }
       date {
           match => ["timestamp" , "EEE MMM dd HH:mm:ss y", "EEE MMM dd HH:mm:ss ZZZ yyyy", "EEE MMM d HH:mm:ss ZZZ yyyy", "dd/MMM/yyyy:HH:mm:ss Z", "YYYY-MM-dd HH:mm:ss", "YYYY-MM-dd HH:mm:ss Z", "YYYY-MMM-dd HH:mm:ss", "dd.MM.YY HH:mm:ss", "MMM dd, yyyy hh:mm:ss a", "dd.MM.YY-HH:mm:ss", "MMM dd HH:mm:ss"]
            }
}

```

Conitnuous grok parse failures...

Format 2: [2018-07-10 01:15:43,195]

since its in square braces, tried creating custome pattern

pattern file:  
SAMPLE\_TIME [%{YEAR}-%{MONTH}-%{MONTHDAY} %{TIME},%{NUMBER}]

logstash conf:

```
 match => { "message" => "%{SAMPLE_TIME}" }
           overwrite => ["message"]
                }

```

But no luck with this also..

---

<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:** [January 11, 2019, 3:03pm UTC](https://discuss.elastic.co/t/unable-to-parse-this-timestamp-very-strange/163903/2 "2019-01-11T15:03:57Z")

</div>

For format 1, you can use "YYYY-MMM-dd HH:mm:ss,SSS"

For format 2, your grok pattern is not anchored, so you can ignore the brackets.

```
"%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day} %{TIME:time},%{NUMBER:z}"

```

Alternatively (and more efficiently), anchor it and escape the brackets

```
"^\[%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day} %{TIME:time},%{NUMBER:z}\]"

```

Then parse the date against "YYYY-MM-dd HH:mm:ss,SSS"

---

<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:** [February 8, 2019, 3:04pm UTC](https://discuss.elastic.co/t/unable-to-parse-this-timestamp-very-strange/163903/3 "2019-02-08T15:04:00Z")

</div>

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