Welcome! Log In Create A New Profile

Advanced

Re: Avoid logging specific user agents requests

April 11, 2015 08:10AM
Page 18 from nginx for Windows - documentation 1.3;

map $request_uri $loggablevhts {
default 1;
/ngxvtstatus 0; # zero=do not log
/vtsvalues.js 0; # zero=do not log
/vtsvalues-eop.js 0; # zero=do not log
/ngxvtstatus/format/json 0; # zero=do not log
}
map $remote_addr $lcladdrvhts {
default 1;
~^(127.0.0.*)$ 0; # zero=do not log
}

# don't log vhts entries when request is local or from management interface
map $loggablevhts$lcladdrvhts $loggable {
default 0;
~1 1;
}

access_log /path/to/access.log combined if=$loggable;

“A request will not be logged if the (IF) condition evaluates to "0" or an empty string”

Two simple ‘maps’ which are then combined tested in the third ‘map’ which is used in the
IF evaluation of the log directive.

Tweak, change, add your own stuff with $request

See also nginx-simple-WAF.conf in the nginx for Windows release archives.

---
nginx for Windows http://nginx-win.ecsds.eu/
Subject Author Posted

Avoid logging specific user agents requests

B.R. April 11, 2015 07:20AM

Re: Avoid logging specific user agents requests

itpp2012 April 11, 2015 08:10AM

Re: Avoid logging specific user agents requests

B.R. April 11, 2015 09:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 139
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready