Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

According to a blog post I found, disabling Nginx access log can speed things up. Nginx have to write to this file every time some one access the site.

But, when setting up fail2ban, I realized that these programs use the access logs to secure the server. So my question is, should I disable the access logs or should I enable them and setup fail2ban?

share|improve this question
up vote 3 down vote accepted

You can use buffer directive:

access_log  /spool/logs/nginx-access.log  gzip  buffer=32k;

This will buffer the access log activity into memory and once the limit has been reached Nginx will then write the logs - this should save disk I/O.

share|improve this answer
It will also compress the log file? – THpubs Aug 25 '12 at 8:16
The logs should be compressed by logrotate by default – HTF Aug 25 '12 at 8:20
But, if its compressed, can fail2ban read them without any problems? – THpubs Aug 25 '12 at 8:21
You can skip the gzip part, I just copied the syntax from Nginx wiki page. By default the most recent log is not compressed. – HTF Aug 25 '12 at 8:25
Perfect... Thanks :) – THpubs Aug 25 '12 at 8:30

The information contained in your logs can be quite valuable (as you've noticed with regard to fail2ban).

Writing to logs is usually buffered and quite efficient. If your server is so busy that writing to your access log is causing you problems then you really need to re-engineer your environment.

Keeping the logs seems like a good thing to me.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.