Hello,
These types of events are processed by wazuh monitoring processes (command or full-command type events).
These events, although they cannot be seen on the dashboard, have the name of the agent where the event was collected in the location tag. In your example it would be something like this: location "(
agent1.example.com) any -> netstat listening ports".
Internally, the location ends up being something like "netstat listening ports", as you can see in the event you shared as an example.
Perform the following local test:
1. Change local_rules.xml:
<rule id="101102" level="0">
<if_sid>530,533</if_sid>
<match>^ossec: output: 'netstat listening ports'</match>
<location>agent1.example</location>
<description>This is a TEST custom rule to suppress FP.</description>
</rule>
2. Run logtest, forcing the location as if it would be the original event:
╰─# /var/ossec/bin/wazuh-logtest -l "(agent1.example.com) any->netstat listening ports"3. Enter the event:
ossec: output: 'netstat listening ports':\ntcp 0.0.0.0:22 0.0.0.0:* 1063/sshd\ntcp6 :::22 :::* 1063/sshd\nudp 127.0.0.1:323 0.0.0.0:* 1015/chronyd\nudp6 ::1:323 :::* 1015/chronyd\ntcp6 :::9100 :::* 1072/node\ntcp 127.0.0.1:32000 0.0.0.0:* 3607712/java\ntcp6 127.0.0.1 :44599 :::* 3607712/java4. Review result:
Starting wazuh-logtest v4.4.4
Type one log per line
ossec: output: 'netstat listening ports':\ntcp
0.0.0.0:22 0.0.0.0:* 1063/sshd\ntcp6 :::22 :::* 1063/sshd\nudp
127.0.0.1:323 0.0.0.0:* 1015/chronyd\nudp6 ::1:323 :::* 1015/chronyd\ntcp6 :::9100 :::* 1072/node\ntcp
127.0.0.1:32000 0.0.0.0:* 3607712/java\ntcp6 127.0.0.1 :44599 :::* 3607712/java
** Wazuh-Logtest: WARNING: (7617): Signature ID '5000' was not found and will be ignored in the 'if_sid' option of rule '100002'.
** Wazuh-Logtest: WARNING: (7619): Empty 'if_sid' value. Rule '100002' will be ignored.
** Wazuh-Logtest: WARNING: (1103): Could not open file 'etc/rules/local_rules2.xml' due to [(13)-(Permission denied)].
**Phase 1: Completed pre-decoding.
full event: 'ossec: output: 'netstat listening ports':\ntcp
0.0.0.0:22 0.0.0.0:* 1063/sshd\ntcp6 :::22 :::* 1063/sshd\nudp
127.0.0.1:323 0.0 .0.0:* 1015/chronyd\nudp6 ::1:323 :::* 1015/chronyd\ntcp6 :::9100 :::* 1072/node\ntcp
127.0.0.1:32000 0.0.0.0:* 3607712/java\ ntcp6
127.0.0.1:44599 :::* 3607712/java'
**Phase 2: Completed decoding.
name: 'ossec'
**Phase 3: Completed filtering (rules).
id: '101102'
level: '0'
description: 'This is a TEST custom rule to suppress FP.'
groups: '['local', 'syslog', 'sshd']'
firedtimes: '1'
mail: 'False'
As you can see, the rule works.
Anyway, to confirm the scenario, I'm going to set up a local environment with a manager and agent, to apply the rule without the logtest. When the test is over, I'll come back to you for the results.
On the other hand, to confirm, the name of the agent to filter should match the name of the agent that collects the event, which you can check with the following command:
╰─# /var/ossec/bin/agent_control -l
Wazuh agent_control. List of available agents:
ID: 000, Name: 200-u20-dev-manager (server), IP: 127.0.0.1, Active/Local
ID: 001, Name: 217-wserver-2022, IP: any, Disconnected
ID: 002, Name: 202-u20-dev-agent, IP: any, Disconnected
ID: 004, Name: 202-win, IP: any, Disconnected
ID: 005, Name: 203-c8, IP: any, Disconnected
ID: 006, Name: 213-openSuseDev, IP: any, Disconnected
Greetings,
Nicolas