Hello.
Your index has the field data.data mapped as type keyword. The indexer expects that this field was a keyword, but the value in your log is a JSON object: ":{\"network_info\":{\"transport_protocol\":\"tcp\",\"target\":\"destination\",\"source\":{\"ip\":\"172.99.99.88\",\"port\":\"59268\",\"mac\":\"a0:51:51:81:c1:51\",\"nbn\":[\"hostname\",\"DOMAIN\"]}. So, when filebeat tries to index this document, it fails with a mapper_parsing_exception error.
To solve this problem, you have different approaches:
For changing the type of the field: you must to stop the filebeat service (systemctl stop filebeat), and edit the /etc/filebeat/wazuh-template.json file to change the type of the data.data field to object type. You will have something like this:
"data": { "properties": { "data": { "type": "object", "dynamic": true } } }If you want to diable the indexing of this field, you can configure the same file as before to something like this:
"data": { "properties": { "data": { "enabled": false } } }Then, to save the file, you must run these commands: filebeat setup -index-managment and systemctl restart filebeat.
Then, you need to re-index the index. You can do this from the Wazuh dashboard, in Index Managment -> Dev tools:
Hello.
Yes, if you receive events that are going to be indexed in the same index as the data.data field is not JSON after changing the type of that field, you will receive the same error again. Another possible solution to avoid this specific problem could be to create a different index to store those events in which the data.data field is different from the rest. This way, you will avoid this problem, in which the rest of the events have the correct field type.
For this, you need to create a new template in which you have to specify the correct type of the data.data field, so that logs are indexed in a new index. You can refer to this documentation https://docs.opensearch.org/latest/im-plugin/index-templates/