# Incremental Grok Works, but logstash grok filter fails to parse simple literal string

**URL:** <https://discuss.elastic.co/t/incremental-grok-works-but-logstash-grok-filter-fails-to-parse-simple-literal-string/56503>\
**Category:** Logstash\
**Created:** [July 27, 2016, 10:45am UTC](https://discuss.elastic.co/t/incremental-grok-works-but-logstash-grok-filter-fails-to-parse-simple-literal-string/56503 "2016-07-27T10:45:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![darioc](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@darioc](https://discuss.elastic.co/u/darioc)\
**Post date:** [July 27, 2016, 10:45am UTC](https://discuss.elastic.co/t/incremental-grok-works-but-logstash-grok-filter-fails-to-parse-simple-literal-string/56503/1 "2016-07-27T10:45:22Z")

</div>

Hello,

Trying to extract as many fields from my log messages, but running into some basic issues.

I have a log message like the following:

INFO 2016-07-21 13:17:48,139 [http-bio-8080-exec-5] com.vendor.recserver.controller.RestController - site:company; abtest:none; pagetemplate:PT\_RelatedRec: Total Time = 1ms. widget:RecentlyViewedProduct time:0ms scanned:0 timebox:none fallback:0 of 5 widget:RelatedRec time:0ms scanned:4 timebox:none fallback:0 of 4 context-url:[http://www.company.com/eu/p/347340](http://www.company.com/eu/p/347340)

When I try to create a grok filter match to extract the site name "company" in the message , it works on incremental grok builder ( [http://grokconstructor.appspot.com/do/constructionstep](http://grokconstructor.appspot.com/do/constructionstep)), but generates a grokparsefailure.

This config does not work:

filter {  
date {  
match =\> ["logtime", "ISO8601"]  
}  
grok {  
match =\> { "message" =\> "%{LOGLEVEL:severity} %{TIMESTAMP\_ISO8601:logtime} %{NOTSPACE:javathread} %{JAVACLASS:class} - site:%{WORD:site} %{GREEDYDATA:therest}"  
}  
}  
}

The next config works up to the java class, but as soon as I try to add the literal to skip over the literal string "- site:" I get the grokparsefailure tag. Also, is there a better way to use literal strings in my message to help match fields?

filter {  
date {  
match =\> ["logtime", "ISO8601"]  
}  
grok {  
match =\> { "message" =\> "%{LOGLEVEL:severity} %{TIMESTAMP\_ISO8601:logtime} %{NOTSPACE:javathread} %{JAVACLASS:class} %{GREEDYDATA:therest}"  
}  
}  
}

Thank you in advance for your help!

Cheers, Dario

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 27, 2016, 1:08pm UTC](https://discuss.elastic.co/t/incremental-grok-works-but-logstash-grok-filter-fails-to-parse-simple-literal-string/56503/2 "2016-07-27T13:08:48Z")

</div>

> match =\> { "message" =\> "%{LOGLEVEL:severity} %{TIMESTAMP\_ISO8601:logtime} %{NOTSPACE:javathread} %{JAVACLASS:class} - site:%{WORD:site} %{GREEDYDATA:therest}"

This doesn't take into account that the actual log message has a semicolon after the site name. If you add that it'll work.

> Also, is there a better way to use literal strings in my message to help match fields?

Not quite sure what you mean here.

---

<div class="post-metadata">

**Author:** ![darioc](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@darioc](https://discuss.elastic.co/u/darioc)\
**Post date:** [July 27, 2016, 3:34pm UTC](https://discuss.elastic.co/t/incremental-grok-works-but-logstash-grok-filter-fails-to-parse-simple-literal-string/56503/3 "2016-07-27T15:34:19Z")

</div>

Hello Magnus,

Thank you that worked. I think I now understand the difference when approaching a grok filter and using traditional regex.

Cheers, Dario

---

<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:** [July 6, 2017, 4:46am UTC](https://discuss.elastic.co/t/incremental-grok-works-but-logstash-grok-filter-fails-to-parse-simple-literal-string/56503/4 "2017-07-06T04:46:15Z")

</div>

Closed on July 6, 2017, 4:46am UTC


