How can I not log specific IP actions in Nginx?

1

I'm getting thousands of IP connections from this IP in my VPS:

51.15.76.184 - - [17 / Dec / 2017: 16: 31: 17 -0200] "CONNECT portal.geniptv.com:8080 HTTP / 1.1" 400 172 "-" "-

The connection is already blocked (error 400), but my access.log file in / var / log / nginx is getting gigabytes in size per day.

How and where do I stop logging this IP above specifically?

My system is Debian 8 with ISPconfig 3.1 and Nginx.

Thank you very much in advance

    
asked by anonymous 17.12.2017 / 20:40

2 answers

0

This is possible using condition and disabling the Nginx access_log .

To do this simply open the file / etc / nginx / sites-available / default and add the code below.

location ~ /(.*)$ {
    if ( $remote_addr = "51.15.76.184" ) {
        access_log off;
    }
}
    
17.12.2017 / 22:32
0

Dear Valdeir, Good and thank you very much for the answer. I rebooted the server and put that block of code but still I kept getting thousands of hits per hour.

What solved was a recommendation from my VPS server veesp.com that told me that there is no way to block logging of a specific IP, but that I could ban the ip in iptables. I stepped down and now stopped logging.

iptables -A INPUT -s 51.15.76.184/32 -i eth0 -j DROP

If someone else has this problem, this is the solution

    
18.12.2017 / 14:29