Apache 2 doesn't log if certain user-agent is found

If none of the more specific forums is the right place to ask

Apache 2 doesn't log if certain user-agent is found

Postby JosephFrench » 2020-08-13 02:56


Ok, I'm coming to ask because I tried a lot of things, followed a lot of solutions from here, and really can't see what is wrong with I'm trying to do.

I have a php server that is used with a game created inside Second Life. The game objects, that can be a lot of them, do checks every minute in the server, this is just making the logs in my server insanely big (rotation logs is an option but I want to reduce their size).

I'm trying to use the SetEnvIf directive in the virtual hosts conf file to not record requests if they came from the second life servers. I only want to log access requests from other sources, not second life. The conf file has settings for two virtual hosts (2 subdomais) but the rule is applied to only one.

Can't do it using IP because the ip of the request can change (sl has a lot of servers). I'm trying to use the User-Agent as following:

Code: Select all
SetEnvIf User_Agent secondlife dontlog
CustomLog /var/www/gensrv/logs/access.log combined env=!dontlog

There is an example of the log:

Code: Select all - - [12/Aug/2020:15:37:30 +0000] "POST /GetServerList.php/?hash=dc3e9cf3019e1c94f865cefaf94c16cc HTTP/1.1" 200 374 "-" "Second-Life-LSL/2020-07-31T15:02:15.545966 (https://secondlife.com)"

The user agent seems to be this, since this is what I get from PHP $_SERVER['HTTP_USER_AGENT'], and always has Second-Life-LSL and the last part for Second Life servers, only the middle changes:

Code: Select all
Second-Life-LSL/2020-07-31T15:02:15.545966 (https://secondlife.com)

I tried the User-Agent with a lot of regex combinations and parts of the user agent info, and it is still logging. I've checked if the setinv is enabled and it is (setenvif_module (shared))

And, really, I can't see what is wrong. The version of Apache is 2.4.38 and is running in a Debian 10 (BUSTER) server.

Thank you.
Posts: 1
Joined: 2020-08-13 02:52

Return to General Questions

Who is online

Users browsing this forum: No registered users and 16 guests