# Need help with parsing logs

**URL:** <https://discuss.elastic.co/t/need-help-with-parsing-logs/167367>\
**Category:** Logstash\
**Created:** [February 6, 2019, 11:00pm UTC](https://discuss.elastic.co/t/need-help-with-parsing-logs/167367 "2019-02-06T23:00:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dips](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@dips](https://discuss.elastic.co/u/dips)\
**Post date:** [February 6, 2019, 11:00pm UTC](https://discuss.elastic.co/t/need-help-with-parsing-logs/167367/1 "2019-02-06T23:00:06Z")

</div>

Hello I am trying to parse log file and wanted to check how I can stop at first encounter of ":" for Tag.

02-05 00:00:13.199 3162 3162 I audit : test: Loaded service\_contexts from /service\_contexts.

Grok filter I have added for this: %{MONTHNUM:Month}-%{MONTHDAY:Day}\s\*%{TIME:Timestamp}\s\*%{NONNEGINT:SID}\s\*%{NUMBER:R\_id}\s\*%{WORD:Severity}\s\*(?(?:[()a-zA-Z0-9./[^]\s]+)):\s\*%{GREEDYDATA:Message}

Can someone please help?

---

<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:** [February 6, 2019, 11:07pm UTC](https://discuss.elastic.co/t/need-help-with-parsing-logs/167367/2 "2019-02-06T23:07:31Z")

</div>

I am unable to parse that regexp, so I am not sure what you want. I would do this using dissect rather than grok.

```
dissect { mapping => { "message" => "%{ts} %{+ts} %{SID} %{R_id} %{severity} %{restOfLine}" } }

```

If you are trying to capture the word audit then change that to

```
dissect { mapping => { "message" => "%{ts} %{+ts} %{SID} %{R_id} %{severity} %{something} : %{restOfLine}" } }
```

---

<div class="post-metadata">

**Author:** ![dips](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@dips](https://discuss.elastic.co/u/dips)\
**Post date:** [February 7, 2019, 10:27pm UTC](https://discuss.elastic.co/t/need-help-with-parsing-logs/167367/3 "2019-02-07T22:27:04Z")

</div>

Thanks. Dissect indeed worked well.

---

<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 7, 2019, 10:32pm UTC](https://discuss.elastic.co/t/need-help-with-parsing-logs/167367/4 "2019-03-07T22:32:27Z")

</div>

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