I'm using an access and error log in Nginx.
I have extremely large number of requests for stats which take up too much storage space in access.log and are not required.
Is it possible to exclude a specific file or folder from logging to access.log?
I would like to exclude all requests to /stats/
server {
listen 80 default_server;
listen 443 ssl default_server;
server_name ***.co.uk www.***.co.uk;
root /var/www/***/html;
index index.html index.php;
access_log /var/www/***/log/access.log;
error_log /var/www/***/log/error.log;
}
You can do this if you know which location block or server is handling the request for stats. Just add the directive access_log off;
to the server or location block in which you want this disabled.
--Edit--
Add this location to your server block:
location /stats/ {
try_files $uri $uri/ =404;
access_log off;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With