Hi
yaswanth,You can separate the events into different indexes and in each index you would see the information you are interested in, you can do this by following these steps: The Wazuh alerts or archives are indexed through an ingest pipeline. These pipelines have a processor that sets the index name using the date_index_name processor with the following schema:
a prefix: wazuh-alerts-4.x- for alerts or wazuh-archives-4.x-* for archives
a suffix: date in the format YYYY.MM.DD
Generating an index name as wazuh-alerts-4.x-2024.10.20 or wazuh-archives-4.x-2024.10.20. Note that alerts and archives datasets have different ingest pipelines. Reference of usage date_index_name processor in the alerts ingest pipeline of the wazuh module for Filebeat:
https://github.com/wazuh/wazuh/blob/v4.5.3/extensions/filebeat/7.x/wazuh-module/alerts/ingest/pipeline.json#L83-L91.
To separate some events to another index, add after the default date_index_name processor, another processor that sets conditionally the index name for a subset of events. Add the condition to apply these processors using the if property. Documentation:
https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html#conditionally-run-processor.
Depending on the format of the index name, contains the date: use the date_index_name processor
https://www.elastic.co/guide/en/elasticsearch/reference/7.10/date-index-name-processor.htmlThe filebeat pipeline sits at
/usr/share/filebeat/module/wazuh/archives/ingest/pipeline.json. You can place something like this in your pipelines:
Replace in /usr/share/filebeat/module/wazuh/archives/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
}
},
By this:
{
"date_index_name": {
"if" : "ctx?.<field> == '<value>'",
"field": "timestamp",
"date_rounding": "d",
"index_name_prefix": "{{fields.index_prefix}}<sufix>-",
"index_name_format": "yyyy.MM.dd",
"ignore_failure": false
}
},
{
"date_index_name": {
"if": "ctx?.<field> != '<value>'",
"field": "timestamp",
"date_rounding": "d",
"index_name_prefix": "{{fields.index_prefix}}",
"index_name_format": "yyyy.MM.dd",
"ignore_failure": false
}
},
Where:
<field> is the field (or subfield in the format field.subfield) that you need to consider in order to catch the logs you need.
<value> is the value that needs to take the field defined before.
<sufix> needed to add a separate name for the index
This will create an index for defender archive logs, it will be wazuh-archives-4.x-<sufix>-* You can check the indexes from Indexer Management -> Dev Tools:
Here you will obtain an index with this name: wazuh-archives-4.x-<sufix>-yyyy.mm.dd
You will need to add one block of this per Operating System. If you need more information about these procedures, you can check the Filebeat documentation: Parse data by using ingest node
You can also refer to
https://documentation.wazuh.com/current/user-manual/wazuh-indexer/wazuh-indexer-indices.htmlLet me know if you need further assistance on this.
Regards,
Hasitha Upekshitha