M
M
Molodmld2021-07-12 13:51:12
Nginx
Molodmld, 2021-07-12 13:51:12

How to stop logging `deny` errors of nginx directive?

There is a list of IP addresses of bots that I block on the server using the deny. The address file looks like this:

deny Ñ…Ñ….Ñ…Ñ….Ñ…Ñ….Ñ…Ñ…;
deny Ñ…Ñ….Ñ…Ñ….Ñ…Ñ….Ñ…Ñ…;
deny Ñ…Ñ….Ñ…Ñ….Ñ…Ñ….Ñ…Ñ…;
deny Ñ…Ñ….Ñ…Ñ….Ñ…Ñ….Ñ…Ñ…;

Every time a request is made to the server from these IP addresses, nginx writes an error in the logs:

[error] 22227#22227: *13997436 access forbidden by rule, client: xx.xx.xx.xx

How to prevent him from logging these errors?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AUser0, 2021-07-12
@Youngmld

You can redirect all requests from these IPs to an empty file.
Or even simpler - return 444;

C
Constantine, 2021-07-12
@psycho-coder

Unfortunately, there is no way to exclude these errors from the log. You can increase the logging level to crit, but you won't see all errors like error there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question