Hello Daan,
Thank you for posting here in the communities.
Before writing a decoder, you need first to test the log with wazuh-logtest
:
# /var/ossec/bin/wazuh-logtest
Starting wazuh-logtest v4.3.9
Type one log per line
Nov 23 08:49:13 THE-SWITCH-NAME TRAPMGR[trapTask]: traputil.c(721) 275164 %% Session 0 of type 3 started for user admin connected from 10.5.3.5
**Phase 1: Completed pre-decoding.
full event: 'Nov 23 08:49:13 THE-SWITCH-NAME TRAPMGR[trapTask]: traputil.c(721) 275164 %% Session 0 of type 3 started for user admin connected from 10.5.3.5'
timestamp: 'Nov 23 08:49:13'
hostname: 'THE-SWITCH-NAME'
**Phase 2: Completed decoding.
No decoder matched.
And as you can see, some fields are being “pre-decoded” so you need to start from the rest of the log. Your parent decoder should look like:
<decoder name="ExtremeNetworks">
<prematch>^\S+[\S+]: </prematch>
</decoder>
As you can see the decoder is being applied:
# /var/ossec/bin/wazuh-logtest
Starting wazuh-logtest v4.3.9
Type one log per line
Nov 23 08:49:13 THE-SWITCH-NAME TRAPMGR[trapTask]: traputil.c(721) 275164 %% Session 0 of type 3 started for user admin connected from 10.5.3.5
**Phase 1: Completed pre-decoding.
full event: 'Nov 23 08:49:13 THE-SWITCH-NAME TRAPMGR[trapTask]: traputil.c(721) 275164 %% Session 0 of type 3 started for user admin connected from 10.5.3.5'
timestamp: 'Nov 23 08:49:13'
hostname: 'THE-SWITCH-NAME'
**Phase 2: Completed decoding.
name: 'ExtremeNetworks'
Having this, you can start writing your child decoders to parse the rest of the fields:
<decoder name="ExtremeNetworks-child">
<parent>ExtremeNetworks</parent>
<regex offset="after_parent">\S+.\w\((\d+)\) </regex>
<order>processnmbr</order>
</decoder>
And you can see how the fields are being parsed:
# /var/ossec/bin/wazuh-logtest
Starting wazuh-logtest v4.3.9
Type one log per line
Nov 23 08:49:13 THE-SWITCH-NAME TRAPMGR[trapTask]: traputil.c(721) 275164 %% Session 0 of type 3 started for user admin connected from 10.5.3.5
**Phase 1: Completed pre-decoding.
full event: 'Nov 23 08:49:13 THE-SWITCH-NAME TRAPMGR[trapTask]: traputil.c(721) 275164 %% Session 0 of type 3 started for user admin connected from 10.5.3.5'
timestamp: 'Nov 23 08:49:13'
hostname: 'THE-SWITCH-NAME'
**Phase 2: Completed decoding.
name: 'ExtremeNetworks'
processnmbr: '721'
I hope this information could be helpful.