Mobile app version of vmapp.org
Login or Join
Tiffany637

: How do I make Apache stop logging " ModSecurity: Access denied"? I have Apache set up on a Linux server and have mod_security enabled. I have a few lines that look like: SecRule REQUEST_URI

@Tiffany637

Posted in: #Apache #Logging

I have Apache set up on a Linux server and have mod_security enabled. I have a few lines that look like:

SecRule REQUEST_URI "^/*admin" drop,phase:1


Because there is no /admin on my website, and I don't want to waste the server resources to serve a 404 page to a bot or hacker.

I've noticed that whenever a page such as /admin is visited, I see in my Apache access logs that an HTTP 301 status with 0 bytes of content was returned (which is exactly what I want). However, I also get a ModSecurity: Access denied with connection close (phase 1). Pattern match "^/*admin" at REQUEST_URI. line in my Apache error logs.

Is there any way I can continue having mod_security append these connection drops to my access logs, but not append anything to my error logs?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Tiffany637

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

Make sure that you don't have log specified - from the documentation on ModSecurity:


Description: Indicates that a successful match of the rule needs to be logged.

Example:

SecAction phase:1,id:117,pass,initcol:ip=%{REMOTE_ADDR},log


This action will log matches to the Apache error log file and the
ModSecurity audit log.


Instead specify nolog:


Description: Prevents rule matches from appearing in both the error and audit logs.

Example:

SecRule REQUEST_HEADERS:User-Agent "Test" allow,nolog,id:121


Although nolog implies noauditlog, you can override the former by
using nolog,auditlog.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme