# Are multiple grok's ok?

**URL:** <https://discuss.elastic.co/t/are-multiple-groks-ok/76283>\
**Category:** Logstash\
**Created:** [February 23, 2017, 6:18pm UTC](https://discuss.elastic.co/t/are-multiple-groks-ok/76283 "2017-02-23T18:18:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhooper](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@mhooper](https://discuss.elastic.co/u/mhooper)\
**Post date:** [February 23, 2017, 6:18pm UTC](https://discuss.elastic.co/t/are-multiple-groks-ok/76283/1 "2017-02-23T18:18:20Z")

</div>

I am parsing generic log4net logs, so all have timestamp threadid level message but only a small percentage have something contained within the remaining message such as "User login = 'USER'".

my question is can I have multiple groks where primary one adds the timestamp threadid level and tempMessage fields, but if another wanted pattern is found I can add fields such as user?

What I'm thinking of is  
\> grok {

> ```
> match => { "message" => "%{TIMESTAMP_ISO8601:sourceTimestamp} \[%{NUMBER:threadId}\] %{LOGLEVEL:level} %{GREEDYDATA:tempMessage}" }
> 
> ```
> 
> }  
> grok {  
> match =\> { "tempMessage" =\> "User login = '%{STRING:user}'"  
> }  
> thanks

---

<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:** [February 24, 2017, 1:51am UTC](https://discuss.elastic.co/t/are-multiple-groks-ok/76283/2 "2017-02-24T01:51:01Z")

</div>

Yep, that's perfectly fine! 🙂

---

<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:** [March 24, 2017, 1:51am UTC](https://discuss.elastic.co/t/are-multiple-groks-ok/76283/3 "2017-03-24T01:51:40Z")

</div>

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