Good morning,
I am using the wazuh agent to be able to send the logs generated by zeek.
When I run zeek in real time and watch how the logs are generated, the information arrives correctly to wazuh.
The problem comes when I run zeek with a pcap, so that I start sending information in bulk. This information is not sent correctly, with the following errors:
- There are some logs that are not sent.
- Sometimes the logs are not even sent, I have to delete them and generate them again.
Attached is the configuration.
- Configuration of the wazuh agent:
<ossec_config>
<localfile>
<log_format>syslog</log_format>.
<location>/opt/opt/zeek/logs/current/*.log</location>
<only-future-events>no</only-future-events>.
</localfile>
</ossec_config>
- The decoders for all sent logs have been created and successfully checked.
- All rules have been added and also checked correctly:
<group name="zeek,ids,">
<rule id="66001" level="15">
<field name="bro_engine">SSH</field>
<description>Zeek: SSH Connection</description>
</rule>
<rule id="66002" level="5">
<field name="bro_engine">SSL</field>
<description>Zeek: SSL Connection</description>
</rule>
<rule id="66003" level="15">
<field name="bro_engine">DNS</field>
<description>Zeek: DNS Query</description>
</rule>
<rule id="66004" level="5">
<field name="bro_engine">CONN</field>
<description>Zeek: Connection detail</description>
</rule>
<rule id="66005" level="5">
<field name="bro_engine">HTTP</field>
<description>Zeek: HTTP detail</description>
</rule>
<rule id="66006" level="5">
<field name="bro_engine">WEIRD</field>
<description>Zeek: WEIRD detail</description>
</rule>
<rule id="66007" level="5">
<field name="bro_engine">INVENTORY</field>
<description>Zeek: INVENTORY detail</description>
</rule>
</group>
<group name="zeek,ids,">
<rule id="66001" level="15">
<field name="bro_engine">SSH</field>
<description>Zeek: SSH Connection</description>
</rule>
<rule id="66002" level="5">
<field name="bro_engine">SSL</field>
<description>Zeek: SSL Connection</description>
</rule>
<rule id="66003" level="15">
<field name="bro_engine">DNS</field>
<description>Zeek: DNS Query</description>
</rule>
<rule id="66004" level="5">
<field name="bro_engine">CONN</field>
<description>Zeek: Connection detail</description>
</rule>
<rule id="66005" level="5">
<field name="bro_engine">HTTP</field>
<description>Zeek: HTTP detail</description>
</rule>
<rule id="66006" level="5">
<field name="bro_engine">WEIRD</field>
<description>Zeek: WEIRD detail</description>
</rule>
<rule id="66007" level="5">
<field name="bro_engine">INVENTORY</field>
<description>Zeek: INVENTORY detail</description>
</rule>
</group>
- Modified the filebeat pipeline (wazuh module) to be able to separate the sending of logs to the different indices:
{
"date_index_name": {
"if": "ctx?.data?.bro_engine == 'CONN'",
{ "field": "timestamp",
"date_rounding": "d",
"index_name_prefix": "{{fields.index_prefix}}conn",
"index_name_format": "yyyy.MM.dd",
"ignore_failure": true
}
},
{
"date_index_name": {
}, { "if": "ctx?.data?.bro_engine == 'DNS'",
{ "field": "timestamp",
"date_rounding": "d",
"index_name_prefix": "{{fields.index_prefix}}dns",
"index_name_format": "yyyy.MM.dd",
"ignore_failure": true
}
},
{
"date_index_name": {
}, { "if": "ctx?.data?.bro_engine == 'INVENTORY'",
{ "field": "timestamp",
"date_rounding": "d",
"index_name_prefix":"{{fields.index_prefix}}inventory",
"index_name_format": "yyyy.MM.dd",
"ignore_failure": true
}
},
{
"date_index_name": {
"if": "ctx?.data?.bro_engine != 'CONN' && ctx?.data?.bro_engine != 'DNS' && ctx?.data?.bro_engine != 'INVENTORY'",
"field": "timestamp",
"date_rounding": "d",
"index_name_prefix": "{{fields.index_prefix}}",
"index_name_format": "yyyy.MM.dd",
"ignore_failure": true
}
},
That's a summary of the wazuh configuration.
After all the trabelshouting performed, it occurs to me that the only possible cause of this error is some missing configuration by the wazuh agent, because sometimes the information arrives correctly to the indexer, that is to say that the error is not in the processing of the information, discarding the following causes:
- Decoder (Wazuh-server)
- Filebeat pipeline (Wazuh-server)
- Indexer (Wazuh-server)
In addition I have to emphasize, that when I was sending data and sometimes I observed that the data arrived and sometimes not, the times that did not coincide in that the wazuh agent was not reading the new logs generated.
I did this check, reading the file:
/var/ossec/var/run/wazuh-logcollector.stateThanks in advance.