Welcome! Log In Create A New Profile

Advanced

access_log if=$variable does not work on ip range

Posted by bbogdan 
access_log if=$variable does not work on ip range
November 02, 2014 02:27AM
Hello,

I have am a long time nginx user, yesterday I was in need to log actions taken by several IP's within a nginx cluster across multi sites.
I thought to use the nginx 1.7.0+ access_log if=$variable to log these actions.

map $remote_addr $loggable {
default 0;
192.168.0.0/16 1;
}

access_log /path/to/iprange.log if=$loggable
I have to say it does work for single ip's quite well but it does not capture anything from ip ranges.

Is this the intended behavior?

Bogdan



Edited 1 time(s). Last edit at 11/02/2014 02:27AM by bbogdan.
Re: access_log if=$variable does not work on ip range
November 02, 2014 06:05AM
What about this instead;

~^(192.168.0.*)$ 1;

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: access_log if=$variable does not work on ip range
November 02, 2014 04:00PM
Works great thank you!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 184
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