Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent (stop) Apache from logging specific AJAX / XmlHttpRequests?

I'm working on a site where the main idea is to do a lot of xmlHttpRequests in a loop (or loop like construct). But the thing is that every time I access the file on my server from the javascript it is logged in access log on the server. Over time the access log file gets so big it slows down the further requests.

Is there a way to tell the apache (I guess) not to log the access to this file if its correct? (I'm sending a get with a password (always different) to this file.) The access to the file will be from different IPs. I don't want to stop all the logging, just the "approved" one.

like image 791
Martin Šajna Avatar asked Apr 03 '12 22:04

Martin Šajna


1 Answers

No problem. Just look at the example from Apache's documentation (a place where you might want to look, if you happen to have an apache-related question in the future). For example:

# Mark requests for the AJAX call
SetEnvIf Request_URI "^/myajaxscript\.php.*$" dontlog
SetEnvIf Request_URI "^/myotherajaxscript\.php$" dontlog
# Log what remains
CustomLog logs/access_log common env=!dontlog
like image 193
Carsten Avatar answered Oct 06 '22 16:10

Carsten