This article will guide you on methods to resolve the error 'ModSecurity failed to open the audit log file' which occur as a result of a missing log files or due to improper permissions.
1. Setting ownership to www-data:www-data and file permissions from 600 to 660 will fix this problem.
2. Ensure that the permissions are properly configured on these files.
Execute the command below:
chmod 0644 /etc/apache2/logs/error_log
chmod 0600 /etc/apache2/logs/modsec_audit.log
The modsec log files are assigned 0600 permissions by default, whereas the error_log is assigned 0644 permissions by default.
3. mkdir permission denied signifies that the user you're running the mkdir as, doesn't have permissions to create new directory in the location you specified.
You should use ls command on the higher level directory to confirm permissions.
4. The mkdir command by default gives rwx permissions for the current user only. To add read, write, and execute permission for all users, add the -m option with the user 777 when creating a directory.