# \_dataparsefailure in tags

**URL:** <https://discuss.elastic.co/t/dataparsefailure-in-tags/200824>\
**Category:** Logstash\
**Created:** [September 24, 2019, 9:11am UTC](https://discuss.elastic.co/t/dataparsefailure-in-tags/200824 "2019-09-24T09:11:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![zebu14](https://avatars.discourse-cdn.com/v4/letter/z/aca169/32.png) [@zebu14](https://discuss.elastic.co/u/zebu14)\
**Post date:** [September 24, 2019, 9:11am UTC](https://discuss.elastic.co/t/dataparsefailure-in-tags/200824/1 "2019-09-24T09:11:10Z")

</div>

Hello,

I think this issue is very common but I am still searching for a solution.

I have this log line :

Mar 9 02:20:42 dvgospxi1 (squid-1): 09/Mar/2017:02:20:42 +0100 - TCP\_DENIED 403 10.117.56.12:47151 3529 GET [http://intranoo.zzz.fr/](http://intranoo.zzz.fr/) text/html 3428 HIER\_NONE - 10.170.226.63 3128 0

(note the two spaces between "Mar" and "9")

Then, this is my grok filter to parse the date :

> grok {  
> match =\> {  
> "message" =\> "%{SYSLOGTIMESTAMP:syslog\_timestamp}.\*%{NUMBER:duration:int}"  
> }  
> }
> 
> ```
> date {
> match => ["syslog_timestamp", "MMM dd HH:mm:ss"]
> timezone => "Europe/Paris"
> }
> 
> ```

In kibana, I obtain the tag "\_dateparsefailure and my timestamp doesn't correspond to the log date but the indexation date.

I think it's all about the two spaces between the month and day, but to handle them in the dissect filter, I usually use the "-\>" to indicate padding.  
There, in the grok filter, I don't know how to handle this.

Any help appreciated.  
Thanks

---

<div class="post-metadata">

**Author:** ![chandu5565](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@chandu5565](https://discuss.elastic.co/u/chandu5565)\
**Post date:** [September 24, 2019, 9:35am UTC](https://discuss.elastic.co/t/dataparsefailure-in-tags/200824/2 "2019-09-24T09:35:52Z")

</div>

Try this date filter

date {  
match =\> ["syslog\_timestamp", "MMM d HH:mm:ss"]  
}  
}

---

<div class="post-metadata">

**Author:** ![zebu14](https://avatars.discourse-cdn.com/v4/letter/z/aca169/32.png) [@zebu14](https://discuss.elastic.co/u/zebu14)\
**Post date:** [September 24, 2019, 9:42am UTC](https://discuss.elastic.co/t/dataparsefailure-in-tags/200824/3 "2019-09-24T09:42:43Z")

</div>

Yes, I can.  
But I think it will be a problem for days above 9 ... no ?

The goal is to handle 1 digit and 2 digits days.

---

<div class="post-metadata">

**Author:** ![chandu5565](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@chandu5565](https://discuss.elastic.co/u/chandu5565)\
**Post date:** [September 24, 2019, 9:48am UTC](https://discuss.elastic.co/t/dataparsefailure-in-tags/200824/4 "2019-09-24T09:48:04Z")

</div>

It will work if the date is of 2 digit.

---

<div class="post-metadata">

**Author:** ![chandu5565](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@chandu5565](https://discuss.elastic.co/u/chandu5565)\
**Post date:** [September 24, 2019, 9:56am UTC](https://discuss.elastic.co/t/dataparsefailure-in-tags/200824/5 "2019-09-24T09:56:54Z")

</div>

For your clarification run the below configuration and change the date in stdin after running configuration.

```auto

input { stdin {} }

filter {
   grok {
match => {"message" => "%{SYSLOGTIMESTAMP:syslog_timestamp}"}
  }
   date {
      match => ["syslog_timestamp", "MMM d HH:mm:ss"]
        }
  }
  
output {
   stdout {}
}

```

---

<div class="post-metadata">

**Author:** ![admlko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/admlko/32/21787_2.png) [@admlko](https://discuss.elastic.co/u/admlko)\
**Post date:** [September 24, 2019, 10:12am UTC](https://discuss.elastic.co/t/dataparsefailure-in-tags/200824/6 "2019-09-24T10:12:58Z")

</div>

Just define multiple patterns, one for 1 digit, another for 2 digits:

```
date {
  match => ["syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss"]
}
```

---

<div class="post-metadata">

**Author:** ![zebu14](https://avatars.discourse-cdn.com/v4/letter/z/aca169/32.png) [@zebu14](https://discuss.elastic.co/u/zebu14)\
**Post date:** [September 24, 2019, 1:28pm UTC](https://discuss.elastic.co/t/dataparsefailure-in-tags/200824/7 "2019-09-24T13:28:52Z")

</div>

Seems to be OK like that.

Thank you for clarification.

---

<div class="post-metadata">

**Author:** ![zebu14](https://avatars.discourse-cdn.com/v4/letter/z/aca169/32.png) [@zebu14](https://discuss.elastic.co/u/zebu14)\
**Post date:** [September 24, 2019, 1:30pm UTC](https://discuss.elastic.co/t/dataparsefailure-in-tags/200824/8 "2019-09-24T13:30:03Z")

</div>

Tried with this method but still got \_dateparsefailure

The previous one from chandu5565 is ok.

---

<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:** [September 24, 2019, 2:00pm UTC](https://discuss.elastic.co/t/dataparsefailure-in-tags/200824/9 "2019-09-24T14:00:10Z")

</div>

> [@zebu14](#):
>
> There, in the grok filter, I don't know how to handle this.

The SYSLOGTIMESTAMP pattern will handle there being two spaces. In a date filter "MMM d HH:mm:ss" will match both

```
Mar 9 02:20:42
Mar 19 02:20:42

```

with a single space, but to handle two spaces you need to add a second pattern to the filter

```
date { match => ["syslog_timestamp", "MMM d HH:mm:ss", "MMM d HH:mm:ss"] }

```

---

<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 22, 2019, 2:00pm UTC](https://discuss.elastic.co/t/dataparsefailure-in-tags/200824/10 "2019-10-22T14:00:11Z")

</div>

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