# Sophos UTM syslog message parsing with Logstash

**URL:** <https://discuss.elastic.co/t/sophos-utm-syslog-message-parsing-with-logstash/185199>\
**Category:** Logstash\
**Created:** [June 11, 2019, 1:26pm UTC](https://discuss.elastic.co/t/sophos-utm-syslog-message-parsing-with-logstash/185199 "2019-06-11T13:26:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skills](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@skills](https://discuss.elastic.co/u/skills)\
**Post date:** [June 11, 2019, 1:26pm UTC](https://discuss.elastic.co/t/sophos-utm-syslog-message-parsing-with-logstash/185199/1 "2019-06-11T13:26:36Z")

</div>

Hi all,

I am struggling to parse Sophos Firewall Syslog messages with logstash. Log format is as follows:

`Jun 11 14:23:57 10.11.223.44 2019:06:11-14:23:57 bewg-t2-ff2-2 ulogd[23094]: id="2001" severity="info" sys="SecureNet" sub="packetfilter" name="Packet dropped" action="drop" fwrule="60002" initf="eth1" outitf="eth1" srcmac="d8:94:03:g6:cd:27" dstmac="00:1a:8c:g0:62:69" srcip="103.188.113.55" dstip="133.222.233.233" proto="6" length="40" tos="0x00" prec="0x00" ttl="242" srcport="54040" dstport="52938" tcpflags="SYN"`

So far I was able to parse up to the ip (would like also to parse custom fields like scrip, destip and so on) with the following grok match:

```
filter {
   grok {
    match => { "message" => "^%{MONTH:month} %{MONTHDAY:day} %{TIME:time} %{IP:ip}" }
      }
  mutate { add_field => {"timedate" => "%{month} %{day} %{time}"}}

  mutate { rename => ["ip", "logsource"]}
  mutate { rename => ["host","syslog-collector"]}
  mutate { remove_field => ["month","day","time"]}
}

```

Reason why I created timedate field is because @timestamp is not the same as the timedate extracted from the logs:  
"timedate" =\> "Jun 11 05:25:23",  
"@timestamp" =\> 2019-06-11T11:48:23.942Z,

Any help would be much appreciated.

---

<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:** [June 11, 2019, 2:21pm UTC](https://discuss.elastic.co/t/sophos-utm-syslog-message-parsing-with-logstash/185199/2 "2019-06-11T14:21:37Z")

</div>

I would use dissect rather than grok

```
    dissect { mapping => { "message" => "%{} %{} %{} %{logsource} %{[@metadata][ts]} %{} %{}[%{}]: %{[@metadata][restOfLine]}" } }
    kv { source => "[@metadata][restOfLine]" }
    date { match => ["[@metadata][ts]", "YYYY:MM:dd-HH:mm:ss" ] }
```

---

<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 9, 2019, 2:21pm UTC](https://discuss.elastic.co/t/sophos-utm-syslog-message-parsing-with-logstash/185199/3 "2019-07-09T14:21:38Z")

</div>

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