# Seeking advice on parsing Nagios logs using pre-built pattern files from herokuapp.com

**URL:** <https://discuss.elastic.co/t/seeking-advice-on-parsing-nagios-logs-using-pre-built-pattern-files-from-herokuapp-com/270850>\
**Category:** Logstash\
**Created:** [April 21, 2021, 1:52pm UTC](https://discuss.elastic.co/t/seeking-advice-on-parsing-nagios-logs-using-pre-built-pattern-files-from-herokuapp-com/270850 "2021-04-21T13:52:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kgeil](https://avatars.discourse-cdn.com/v4/letter/k/958977/32.png) [@kgeil](https://discuss.elastic.co/u/kgeil)\
**Post date:** [April 21, 2021, 1:52pm UTC](https://discuss.elastic.co/t/seeking-advice-on-parsing-nagios-logs-using-pre-built-pattern-files-from-herokuapp-com/270850/1 "2021-04-21T13:52:51Z")

</div>

Good morning everyone. I'm early in the Elastic Stack learning curve, and I'm working on parsing some nagios logs this morning. I Have nagios logging to syslog, and can use the pattern file located on the herokuapp grok debugger site to parse individual lines. (Patterns here: [Grok Debugger](https://grokdebug.herokuapp.com/patterns#))

I know that I can set up conditionals in my logstash filter to use each established pattern in the provided file such as:

```auto
match => { "message" => "%{NAGIOSTIME} %{NAGIOS_CURRENT_HOST_STATE}" }
match => { "message" => "%{NAGIOSTIME} %{NAGIOS_CURRENT_SERVICE_STATE}" }

```

but, from the looks of the file provided on herokuapp, I feel like most of the parsing work is already done for me, and I just don't know how to use it.

For example, I have two different log lines:

```auto
[1618027200] CURRENT HOST STATE: AdmissionGate1;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 4.88 ms
[1618027200] CURRENT SERVICE STATE: AdmissionGate2;HTTP;OK;HARD;1;HTTP OK: HTTP/1.1 302 Found - 480 bytes in 0.120 second response time

```

Will I need to build a config file with separate match patterns, or is there a graceful way to just use all of the patterns in the file?

I'm very grateful for any advice provided.

Thank you!  
Kevin

---

<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:** [April 21, 2021, 2:14pm UTC](https://discuss.elastic.co/t/seeking-advice-on-parsing-nagios-logs-using-pre-built-pattern-files-from-herokuapp-com/270850/2 "2021-04-21T14:14:05Z")

</div>

The patterns [include](https://github.com/logstash-plugins/logstash-patterns-core/blob/7f94275ec8212f7f0aa6eb4ac5dbf3d70cd05cac/patterns/legacy/nagios#L124) one that is an alternation of all the patterns, so I think you should be able to do

```
match => { "message" => "^%{NAGIOSLOGLINE}" }
```

---

<div class="post-metadata">

**Author:** ![kgeil](https://avatars.discourse-cdn.com/v4/letter/k/958977/32.png) [@kgeil](https://discuss.elastic.co/u/kgeil)\
**Post date:** [April 21, 2021, 2:48pm UTC](https://discuss.elastic.co/t/seeking-advice-on-parsing-nagios-logs-using-pre-built-pattern-files-from-herokuapp-com/270850/3 "2021-04-21T14:48:09Z")

</div>

Wow @Badger , it IS that easy. Thanks so much for the speedy reply. I had seen this, and tried it, but of course, had a syntax error, and my file didn't parse. It now does its job beautifully.

Thanks again,

Kevin

---

<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:** [May 19, 2021, 2:48pm UTC](https://discuss.elastic.co/t/seeking-advice-on-parsing-nagios-logs-using-pre-built-pattern-files-from-herokuapp-com/270850/4 "2021-05-19T14:48:24Z")

</div>

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