Hi Brenno,
I believe you are trying to create custom index name based on the alert rule.groups name.
For this, you need to make changes in the filebeat ingest pipeline.
Replaced in /usr/share/filebeat/module/wazuh/alerts/ingest/pipeline.json this:
{
"date_index_name": {
"field": "timestamp",
"date_rounding": "d",
"index_name_prefix": "{{fields.index_prefix}}",
"index_name_format": "yyyy.MM.dd",
"ignore_failure": false
}
},
With this
{
"date_index_name": {
"if": "ctx.rule?.groups == 'browser_history'",
"field": "timestamp",
"date_rounding": "d",
"index_name_prefix": "{{fields.index_prefix}}browser-history-",
"index_name_format": "yyyy.MM.dd",
"ignore_failure": true
}
},
{
"date_index_name": {
"if": "ctx.rule?.groups == 'browser_error'",
"field": "timestamp",
"date_rounding": "d",
"index_name_prefix": "{{fields.index_prefix}}browser-error-",
"index_name_format": "yyyy.MM.dd",
"ignore_failure": true
}
},
{
"date_index_name": {
"if": "ctx.rule?.groups != 'browser_history' && ctx.rule?.groups != 'browser_error'",
"field": "timestamp",
"date_rounding": "d",
"index_name_prefix": "{{fields.index_prefix}}",
"index_name_format": "yyyy.MM.dd",
"ignore_failure": false
}
},
Load the pipeline.
filebeat setup --pipelines
systemctl restart filebeat
This will create an index for these rule groups. For browser_history, it will be wazuh-alerts-4.x-browser-history-yyyy-mm-dd
You can check the indexes from Indexer Management -> Dev Tools:
GET /_cat/indices
Let me know if this works for you.
