Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I'm hoping to get some direction on how to set up truncating and gzip'ing on my domains' access logs. I notice that the core nginx access logs get split and compressed by default, yet my individual access logs continue to grow.

Is this something that can be set up and is handled by nginx or something else on my system that is managing it's core logs?

share|improve this question
Use logrotate? – Michael Hampton Sep 13 '12 at 15:34
up vote 10 down vote accepted


/var/log/nginx/access_log {
    rotate 7
    size 5k
    dateformat -%Y-%m-%d
        test -r /var/run/ && kill -USR1 `cat /var/run/`
share|improve this answer
Awesome. Logrotate was new to me. Makes perfect sense now. Thanks! – Rob Sep 13 '12 at 15:41

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.