0

I'm using the following code to filter out certain IPs in my access log:

map $remote_addr $log_ip {
    #list IPs here to filter from access log
    "10.1.0.1" 0;  #all internal access
    "100.100.100.100" 0; #Remote dev IP
    default 1;
}

log_format          main  '[$time_iso8601] $remote_addr - $server_name:$server_port > $proxy_host:$proxy_port ($request - $status)';
access_log          logs/access.log  main if=$log_ip;

What I would prefer would be to have a separate access log for "known" addresses.

Something like:

access_log_unknown      logs/access.log  main if=$log_ip;
access_log_known        logs/access.log  main if=!$log_ip;

Is this possible?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.