Hi Reza,
Hope you are doing well. Thank you for using Wazuh.
By default, Docker container logs only show stdout and stderr standard streams, which are cleared when the container is destroyed. out_format in localfile option allows formatting logs from Logcollector using field substitution.
Check this document for details:
https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#out-format
I would also suggest you to check this document for some reference:
https://wazuh.com/blog/docker-container-security-monitoring-with-wazuh/
Also check these documents:
https://wazuh.com/blog/monitoring-docker-container-logs-with-wazuh/
The easiest way to tackle this issue would be to write a new decoder based on your log format.
If you need help with writing decoder check this document:
https://documentation.wazuh.com/current/user-manual/ruleset/ruleset-xml-syntax/decoders.html
I hope this helps. Let me know the update on the issue.
Regards
Md. Nazmur Sakib
Hi Reza,
I am not sure if using this will help tune your log with this local-file option.
<out_format>$(log.log)</out_format>
You can alternatively tune your existing decoders with a Regular Expression wildcard. So that it skips the last part of the log while matching.
\.+ To match one or more times anything.
Check this document to learn more about regex syntax:
https://documentation.wazuh.com/current/user-manual/ruleset/ruleset-xml-syntax/regex.html
I hope this information helps.
Regards
Md. Nazmur Sakib
Hi Reza,
Hope you are doing well. Sorry for the late response.
Can you try changing the log format from JSON to Syslog?
<localfile>
<log_format>syslog</log_format>
<location>/path/to/docker/logs</location>
</localfile>
You can also try to write a custom script to trim your log and save it in a new file. And monitor that new file with </localfile>
I do not have expatriates in scripting.
I am sharing a document for your reference:
https://unix.stackexchange.com/questions/572161/linux-command-to-trim-a-log-file
Regards
Md. Nazmur Sakib