# Logstash - tagging snort\[#####\] not working

**URL:** <https://discuss.elastic.co/t/logstash-tagging-snort-not-working/160022>\
**Category:** Logstash\
**Created:** [December 8, 2018, 11:48pm UTC](https://discuss.elastic.co/t/logstash-tagging-snort-not-working/160022 "2018-12-08T23:48:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kozoke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@kozoke](https://discuss.elastic.co/u/kozoke)\
**Post date:** [December 8, 2018, 11:48pm UTC](https://discuss.elastic.co/t/logstash-tagging-snort-not-working/160022/1 "2018-12-08T23:48:34Z")

</div>

Hi,

I'm attempting to extract pfsense logs, specifically the snort plugin alert logs.

I've pulled the following filter from this site:  
[https://gist.githubusercontent.com/mrlesmithjr/0799cdc3710f2ae1e182/raw/cfad5b0740928060b9322fcc5a4406073cc446ce/pfsense\_snort\_logstash](https://gist.githubusercontent.com/mrlesmithjr/0799cdc3710f2ae1e182/raw/cfad5b0740928060b9322fcc5a4406073cc446ce/pfsense_snort_logstash)

My filter is this:  
if [prog] == /snort$ / {  
mutate {  
add\_tag =\> ["snort"]  
}  
}

Logstash shows this as the [prog] field - so it is parsing this out (which is snort[pid]:  
snort[59585]

Question is - how can I tag this text snort[#####]  
so the rest of the filter works?

I'm guessing my filter match is incorrect?

Thanks!

Full unfiltered sample log below.  
```\<33\>Dec 3 18:59:27 snort[38444]: [1:2402000:5016] ET DROP Dshield `Preformatted Block Listed Source group 1 [Classification: Misc Attack] [Priority: 2] {TCP}`Preformatted ###.###.###.###: -\> ###.###.###.###:

---

<div class="post-metadata">

**Author:** ![kozoke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@kozoke](https://discuss.elastic.co/u/kozoke)\
**Post date:** [December 12, 2018, 2:25am UTC](https://discuss.elastic.co/t/logstash-tagging-snort-not-working/160022/2 "2018-12-12T02:25:47Z")

</div>

I figured it out.

Here is the match pattern:

```auto
            if "snort" in [prog] {             
              mutate {
                add_tag => ["snort"]
              }
            }

```

Here is the grok pattern if anyone is interested.

```auto
      grok {
        match => [
          "message", "\[%{INT:ids_gid}:%{INT:ids_sid}:%{INT:ids_rev}\]%{DATA:preprocessor}%{GREEDYDATA:ids_alert}.\[Classification\:%{DATA:ids_classification}\].*\[Priority\: %{INT:ids_priority}].*{%{WORD:ids_proto}}.*%{IP:src_ip}:%{INT:src_port} \-\>.*%{IP:dst_ip}:%{INT:dst_port}",
          "message", "\[%{INT:ids_gid}:%{INT:ids_sid}:%{INT:ids_rev}\].%{GREEDYDATA:message2}"
        ]
      }

```

---

<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:** [January 9, 2019, 2:25am UTC](https://discuss.elastic.co/t/logstash-tagging-snort-not-working/160022/3 "2019-01-09T02:25:55Z")

</div>

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