Add log rotation for mod_security logs
Since 2014-11-06 extensive logging has been done by mod_security under:
/usr/local/apache/logs/modsec_audit/~username
this presents 2 problems:
1) the logs are kept under cpanel user ownership and are counted towards disk usage (under Other Disk Usage)
2) the logs eat up a lot of space, in some cases 5Mib per day = 150Mib/month and having 100 users would be 15Gib space per month
extensive loggin occurs when using OWASP or other large rulesets.
from my conclusion only mod_security + mod_ruid creates log files under:
/usr/local/apache/logs/modsec_audit/
Currently there is in-built no log rotation or option to clean up these logs.
I handled it temporarily with a cronned script:
- #!/bin/bash
- echo "cleaning up files older than 7 days from modsec logs:"
- find /usr/local/apache/logs/modsec_audit/ -type f -mtime +7 -exec rm {} \;
We need an urgent solution to keep these logs in check and not fill up the disk with logs.
I suggest an option to set mod_security logs for X days + include them in log rotation.
In cPanel & WHM version 11.50 we are adding a logrotate configuration for the main mod_security audit log. In addition we updated our log rotation daemon, cpanellogd, to handle the per user log files when using mod_ruid2.
In cPanel & WHM version 11.50 we are adding a logrotate configuration for the main mod_security audit log. In addition we updated our log rotation daemon, cpanellogd, to handle the per user log files when using mod_ruid2.
Hello,
I just had the same issue where server performance was degrading over time with requests getting stuck in Logging.
Not sure if this was the cause hope so but i found this feature while searching for log rotation on mod_security.
I've made a change to the find command, here's mine:
The reason is this way it deletes the old directories and not only the files
Edited: change find options order to avoid warning
Hello,
I just had the same issue where server performance was degrading over time with requests getting stuck in Logging.
Not sure if this was the cause hope so but i found this feature while searching for log rotation on mod_security.
I've made a change to the find command, here's mine:
The reason is this way it deletes the old directories and not only the files
Edited: change find options order to avoid warning
In cPanel & WHM version 11.50 we are adding a logrotate configuration for the main mod_security audit log. In addition we updated our log rotation daemon, cpanellogd, to handle the per user log files when using mod_ruid2.
In cPanel & WHM version 11.50 we are adding a logrotate configuration for the main mod_security audit log. In addition we updated our log rotation daemon, cpanellogd, to handle the per user log files when using mod_ruid2.
Replies have been locked on this page!