Example scenario: Each endpoint normally generates a relatively stable amount of log data under /var/log/. A sudden and unexplained spike in log volume can indicate malware activity, brute-force attempts, unauthorized processes, or system misuse. This scenario continuously monitors the raw size of the /var/log directory and identifies abnormal growth based on the endpoint’s own historical baseline.
Goal: Detect unusually high log volume on any endpoint, generate alerts, and enable automated responses such as email notifications or integration with SOAR workflows.
The detection process is implemented using three components:
ossec.conf). A Wazuh localfile command periodically measures the size of /var/log in the agents.local_decoder.xml) extract the relevant fields from the command output.Active responses handle detected suspicious events:
/radar/scenarios/active_responses/radar_ar.py)
We distinguish between:
/var/log volume monitoring:
nano /var/ossec/etc/ossec.conf
And paste the content of /radar/scenarios/agent_configs/log_volume/radar-log-volume-agent-snippet.xml inside of <ossec_config> tag.
systemctl restart wazuh-agent
/radar/scenarios/decoders/log_volume into the /var/ossec/etc/decoders//radar/scenarios/decoders/log_volume into the /var/ossec/etc/rules/cp /radar/scenarios/active_responses/radar_ar.py /var/ossec/active-response/bin/radar_ar.py
chmod 750 /var/ossec/active-response/bin/radar_ar.py
chown root:wazuh /var/ossec/active-response/bin/radar_ar.py
/radar/scenarios/ossec/radar-log-volume-ossec-snippet.xml into the end of /var/ossec/etc/ossec.conf under <ossec_config> tag./var/ossec/bin/wazuh-control restart
data.log_bytes in index wazuh-archives-* is a numerical field in Index Management Menu.log_volume-detectorwazuh-archives-*@timestamp5m (with 1m window delay)| Feature name | Method | Field | Notes |
|---|---|---|---|
max_log_bytes |
max |
data.log_bytes |
Maximum value of the log_bytes in the given detection interval |
Under Categorical field, select the agent identifier agent.name.keyword.
This ensures each endpoint gets its own statistical model.
Note: The categorical field in the UI documentation shows agent.name.keyword, while config.yaml shows agent.name without the .keyword suffix. OpenSearch automatically uses the keyword field type for categorical fields when available, so both forms are functionally equivalent.
Click Next to Review.
This webhook is a simple Flask application that receives the monitor’s payload and appends a single line to /var/log/ad_alerts.log. To deploy the webhook in the Wazuh manager:
chmod +x ad_alerts_webhook.py
python3 ad_alerts_webhook.py
/var/ossec/etc/ossec.conf needs to be configured:
```xml```
In log_volume-detector Anomaly overview, set up alert:
LogVolume-Growth-DetectedWhen choosing thresholds for firing alerts, you must balance sensitivity (catching real threats) against precision (avoiding false positives). A balanced strategy is to require:
RADARMessage (must be JSON)
{
"monitor": {
"name": ""
},
"trigger": {
"name": ""
},
"entity": "",
"periodStart": "",
"periodEnd": ""
}
When the condition is met, this monitor will send structured JSON to the webhook.