Hello,
Your current configuration is correct if you want to monitor realtime changes to the ossec.conf file, however the issue lies in how the real-time monitoring is set up for new directories and files.
Here’s how you can adjust your configuration to ensure that new agent.conf files in newly created directories are detected in real-time.
- Instead of monitoring /var/ossec/etc/shared/*/agent.conf, monitor the parent directory /var/ossec/etc/shared/ with real-time changes enabled. This will ensure that any changes within this directory structure, including new subdirectories and new agent.conf files, are detected in real-time.
or
- Use recursive monitoring to ensure that changes in subdirectories are also picked up.
Here’s how you can modify your ossec.conf:
<directories realtime="yes" report_changes="yes" recursion_level="3">/var/ossec/etc/shared/</directories>
You can find more information
here on how to achieve this.
I hope this helps