Hello,
You can retrieve specific alerts from the Wazuh Indexer API by filtering based on certain parameters. For example, to get critical severity alerts collected on 01/10/2024, you can use the following command:
curl -k -u admin:<INDEXER_ADMIN_PASS> "https://<INDEXER_IP>:9200/wazuh-alerts-4.x-2024.10.01/_search?pretty=true" -H 'Content-Type: application/json' -d '
{
"query": {
"bool": {
"must": [
{
"range": {
"rule.level": {
"gte": 15
}
}
}
]
}
}
}'
This query fetches all alerts collected on 01/10/2024 with a rule level greater than or equal to 15.
The query targets a specific alert index (wazuh-alerts-4.x-2024.10.01/). However, more refined filtering is possible. For instance, you can modify the query to retrieve the same results using a timestamp filter, searching over all the alerts indices:
curl -k -u admin:<INDEXER_ADMIN_PASS> "https://<INDEXER_IP>:9200/wazuh-alerts-4.x-*/_search?pretty=true" -H 'Content-Type: application/json' -d '
{
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "now-1d/d",
"lt": "now"
}
}
},
{
"range": {
"rule.level": {
"gte": 15
}
}
}
]
}
}
}'You can achieve highly customizable alert management by utilizing these kinds of queries in a custom script automated via cron or another method.
Additionally, review the reports and email configuration to determine if they could meet your requirements. For further details, you can refer to the documentation on
report generation and the guide on
configuring email alerts, which may offer additional options that suit your needs.
Feel free to reach out if you have further questions.