# Logstash parse grok

**URL:** <https://discuss.elastic.co/t/logstash-parse-grok/73337>\
**Category:** Logstash\
**Created:** [January 31, 2017, 10:06am UTC](https://discuss.elastic.co/t/logstash-parse-grok/73337 "2017-01-31T10:06:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![taurs](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@taurs](https://discuss.elastic.co/u/taurs)\
**Post date:** [January 31, 2017, 10:06am UTC](https://discuss.elastic.co/t/logstash-parse-grok/73337/1 "2017-01-31T10:06:39Z")

</div>

[7/1/05 13:41:00:516 PDT] -- log line

```
 ( \[%{DD/MM/YY HH:MM:SS:S Z}\] ) -- this is the grok pattern i have used. 

```

Doesnt seem to work. Can anyone help with this logstash grok pattern

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 31, 2017, 10:17am UTC](https://discuss.elastic.co/t/logstash-parse-grok/73337/2 "2017-01-31T10:17:12Z")

</div>

You need to look at the sub-seconds you have, it doesn't match.

However you should really use the date filter here.

---

<div class="post-metadata">

**Author:** ![taurs](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@taurs](https://discuss.elastic.co/u/taurs)\
**Post date:** [January 31, 2017, 10:56am UTC](https://discuss.elastic.co/t/logstash-parse-grok/73337/3 "2017-01-31T10:56:36Z")

</div>

input {  
file {  
path =\> "/home/ubuntu/sound/logstash-5.0.0/bin/sta.log"  
start\_position =\> "beginning"  
}  
}  
filter {  
grok {  
match =\>" \[%{DATA:timestamp}\] "  
}  
date {  
match =\> ["timestamp","DD/MM/YY HH:MM:SS:S ZZZ"]  
}  
}  
output {  
stdout{codec =\> "json"}  
}

this is the configuration I have used.

And consider this as my sta.log file content:  
[7/1/05 13:41:00:516 PDT]

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 31, 2017, 8:15pm UTC](https://discuss.elastic.co/t/logstash-parse-grok/73337/4 "2017-01-31T20:15:06Z")

</div>

> [@taurs](#):
>
> DD/MM/YY HH:MM:SS:S ZZZ

Does not match

> [@taurs](#):
>
> 7/1/05 13:41:00:516 PDT

---

<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 28, 2017, 8:15pm UTC](https://discuss.elastic.co/t/logstash-parse-grok/73337/5 "2017-02-28T20:15:16Z")

</div>

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