Excluding local calls from nginx logs

This commit is contained in:
Kasra Bigdeli
2019-02-27 22:54:43 -08:00
parent c9897258bc
commit 0549827ed8

View File

@@ -14,11 +14,22 @@ http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
geo $remote_addr $ip_in_log {
# CIDR Range IPs:
172.16.0.0/12 0;
10.0.0.0/8 0;
192.168.0.0/16 0;
default 1;
}
log_format main '$remote_addr - $remote_user [$time_local] "$host" "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
access_log /var/log/nginx/access.log main if=$ip_in_log;
sendfile on;
#tcp_nopush on;