Hello,
I've started forwarding my pfsense syslog to Wazuh, but I'm struggling to decode them in Wazuh (default decoders are not working).
My pfsense is set to send log in syslog format (RFC 5424, with RFC 3339 microsecond-precision timestamp). I have tested turning the logall option for a bit, I can positively confirm that the wazuh manager is receiving the syslog.
Here is a few lines that i found in my
/var/ossec/logs/archives/archives.log after turning logall to on:
2023 Jul 03 04:53:45 wazuh->192.168.100.1 1 2023-07-03T04:53:45.034138+00:00 fw1.network.arpa filterlog 73381 - - 230,,,1630278040,lagg1.60,match,block,in,4,0x0,,255,1974,0,none,17,udp,125,192.168.60.53,224.0.0.251,5353,5353,105
2023 Jul 03 04:53:45 wazuh->192.168.100.1 1 2023-07-03T04:53:45.034173+00:00 fw1.network.arpa filterlog 73381 - - 231,,,1630278040,lagg1.60,match,block,in,6,0x00,0xe0000,255,UDP,17,105,fe80::14c4:d75e:c885:f081,ff02::fb,5353,5353,105
2023 Jul 03 04:53:45 wazuh->192.168.100.1 1 2023-07-03T04:53:45.034158+00:00 fw1.network.arpa filterlog 73381 - - 231,,,1630278040,lagg1.60,match,block,in,6,0x00,0xe0000,255,UDP,17,105,fe80::14c4:d75e:c885:f081,ff02::fb,5353,5353,105
2023 Jul 03 04:53:46 wazuh->192.168.100.1 1 2023-07-03T04:53:46.035108+00:00 fw1.network.arpa filterlog 73381 - - 327,,,1657929018,lagg1.120,match,block,in,4,0x0,,128,48607,0,DF,6,tcp,52,192.168.120.52,192.168.60.170,26384,9100,0,S,2886259890,,64240,,mss;nop;wscale;nop;nop;sackOK
In this snippet, we can see that the ordering of certain fields is different depending on ipv4 is used vs ipv6. I was thinking of approaching this by creating 2 decoder, one for ipv4, and one for ipv6.
I started working on the ipv4 decoder, but I cannot get it to work as intended. This is what my decoder is looking like so far:
<decoder name="pf-fw">
<prematch>filterlog</prematch>
</decoder>
<decoder name="pf-fw-ipv4">
<parent>pf-fw</parent>
<regex>\S*?,\S*?,\S*?,(\S*?),(\S*?),\S*?,(\S*?),\S*?,4,\S*?,\S*?,\S*?,\S*?,\S*?,\S*?,\S*?,(\S*?),\S*?,(\S*?),(\S*?),(\S*?),(\S*?),</regex>
<order>ruleid,interface,action,protocol,srcip,dstip,srcport,dstport</order>
</decoder>
When testing the rule, it doesn't decode the fields I want to. Here's the output of the test:
**Messages:
INFO: (7202): Session initialized with token 'XXXX'
**Phase 1: Completed pre-decoding.
full event: '2023 Jul 03 04:53:45 wazuh->192.168.100.1 1 2023-07-03T04:53:45.034138+00:00 fw1.network.arpa filterlog 73381 - - 230,,,1630278040,lagg1.60,match,block,in,4,0x0,,255,1974,0,none,17,udp,125,192.168.60.53,224.0.0.251,5353,5353,105'
timestamp: '2023 Jul 03 04:53:45'
**Phase 2: Completed decoding.
name: 'pf-fw'
Can someone help me understand what I'm doing wrong? I am still fairly new to Wazuh, any help would be appreciated.
Thank you,
/JP