Hi, we were able to identify the reason why "analysisd" fails on reboot.
wazuh-analysisd breaks due to excessive memory consumption
The rules you design share <group> and <if_groups>, that has quadratic growth in rule creation and memory consumption!
One rule:
2023/02/08 08:11:42 wazuh-analysisd: INFO: Total rules enabled: '6773'
10 rules:
2023/02/08 08:12:20 wazuh-analysisd: INFO: Total rules enabled: '42587'
19 rules:
2023/02/08 08:14:01 wazuh-analysisd: INFO: Total rules enabled: '36968795'
29 rules:
Killed
The explanation for this behavior is that <if_group> is a kind of shortcut that instantiates a rule of type <if_sid> under each rule of the specified group. Since the child rules also belong to the same <group> if we create a series of rules with <if_group>, the memory efficiency is O(n²).
The solution to the problem is to either redraw the rule tree or create a parent rule and then create the child rules using the <
if_sid> option. Something like that:
<group name="custom,">
<rule id="100020" level="0">
<description>MSSQL XPCmdshell Rules</description>
<if_group>windows,</if_group>
</rule>
<rule id="100021" level="13">
<description>MSSQL XPCmdshell Suspicious Execution</description>
<group>windows,application,</group>
<if_sid>100020</if_sid>
<field name="win.system.providerName" negate="no" type="pcre2">(?i)^(?:MSSQLSERVER)$</field>
<field name="win.system.eventID" negate="no" type="pcre2">(?i)^(?:33205)$</field>
<field name="win.evendata.data" negate="no" type="pcre2">(?i)(object_name:xp_cmdshell)</field>
<field name="win.evendata.data" negate="no" type="pcre2">(?i)(statement:EXEC)</field>
</rule>
<rule id="100023" level="13">
<description>MSSQL XPCmdshell Option Change</description>
<group>windows,application,</group>
<if_sid>100020</if_sid>
<field name="win.system.providerName" negate="no" type="pcre2">(?i)^(?:MSSQLSERVER)$</field>
<field name="win.system.eventID" negate="no" type="pcre2">(?i)^(?:15457)$</field>
<field name="win.evendata.data" negate="no" type="pcre2">(?i)(xp_cmdshell)</field>
</rule>
</group>
Regarding why the reboot from the dashboard does not fail, we are analyzing the problem and will inform you when we have news.
Regards !