We noticed that /var/log/apache2/modsec_audit.log is becoming extremely large because ModSecurity is logging full client requests. We have one customer in particular sending huge POST requests containing base64-encoded images, which causes the log to grow very quickly:
![2026-05-21 14_50_47-_new 3 - Notepad++ [Administrator].png Click image for larger version
Name: 2026-05-21 14_50_47-_new 3 - Notepad++ [Administrator].png
Views: 67
Size: 485.5 KB
ID: 40940](filedata/fetch?id=40940&d=1779387358)
It looks like logrotate only runs once per day during the night, so while the log does get rotated, the compressed file also ends up being huge.
Is it really necessary to log the full POST body? Would something like this be safe to use?
So ModSecurity does not log the request body.
Would this break any Imunify360 functionality? If not, where would be the proper place to add this configuration so it does not get overwritten by future updates?
Thanks.
Code:
# ls -lh /var/log/apache2/ total 49G -rw-r--r--. 1 root root 8.0M May 21 09:32 access_log drwx--x--x. 48 root wheel 20K May 21 09:28 domlogs -rw-r--r--. 1 root root 9.7M May 21 09:32 error_log drwx------ 2 nobody nobody 6 Nov 20 2024 lsapisock -rw-r--r-- 1 root nobody 75M May 21 01:02 lsphp-stderr.log drwx-wx-wt. 2 root root 6 May 18 16:05 modsec_audit -rw------- 1 root root 980M May 21 09:32 modsec_audit.log -rw------- 1 root root 64M May 6 23:59 modsec_audit.log-20260507.gz -rw------- 1 root root 231M May 11 00:00 modsec_audit.log-20260511.gz -rw------- 1 root root 2.1G May 11 23:59 modsec_audit.log-20260512.gz -rw------- 1 root root 1.6G May 13 00:00 modsec_audit.log-20260513.gz -rw------- 1 root root 9.6G May 14 00:00 modsec_audit.log-20260514.gz -rw------- 1 root root 7.4G May 14 23:59 modsec_audit.log-20260515.gz -rw------- 1 root root 2.3G May 15 23:59 modsec_audit.log-20260516.gz -rw------- 1 root root 486M May 17 00:00 modsec_audit.log-20260517.gz -rw------- 1 root root 1.1G May 19 00:00 modsec_audit.log-20260519.gz -rw------- 1 root root 11G May 19 23:59 modsec_audit.log-20260520.gz -rw------- 1 root root 13G May 21 00:01 modsec_audit.log-20260521.gz -rw------- 1 root root 10 May 21 09:32 modsec_audit.log.filetail.state
It looks like logrotate only runs once per day during the night, so while the log does get rotated, the compressed file also ends up being huge.
Is it really necessary to log the full POST body? Would something like this be safe to use?
Code:
SecAuditLogParts ABIJDEFHZ
So ModSecurity does not log the request body.
Would this break any Imunify360 functionality? If not, where would be the proper place to add this configuration so it does not get overwritten by future updates?
Thanks.
Comment