Hello,
By default, the data stored in the /log/alerts/ directory is not going to be deleted, so all the alerts that are being generated will be saved. If you want to keep one year of security logs you can perform these two steps:
- First of all, set the crontab script to remove logs from /var/ossec/logs/alerts. To apply crontab please run this command: crontab -e. It will open your crontab file where you will be able to add the commands you need. For example, as you need 1 year of security logs, an example of your crontab script would be:
45 0 * * * find /var/ossec/logs/alerts/ -name "*.gz" -type f -mtime +365 -exec rm -f {} \;
This will delete all the alerts that are older than a year. You can set it to any other date to, for example, this script would retain logs for 90 days:
45 0 * * * find /var/ossec/logs/alerts/ -name "*.gz" -type f -mtime +90 -exec rm -f {} \;
You can obtain more information about Cron Job
here and
here.
- The second step would be applying a year retention policy to the Elasticsearch indices. The PCI standard requires one year of cold storage and three months of hot storage. If you implement this type of policy you will be saving more disk space than applying one year of hot storage. You can check
this guide and follow the steps explained there to accomplish either one year of hot storage or three months of hot storage and one year of cold storage.
Hope I was helpful. Let me know if you face any issues while approaching any of these steps.
Regards,
Yana.