Proper way to rotate Nginx logs
        Posted  
        
            by 
                depesz
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by depesz
        
        
        
        Published on 2009-09-14T12:24:15Z
        Indexed on 
            2010/12/29
            9:55 UTC
        
        
        Read the original article
        Hit count: 323
        
I would like to achieve rotation of nginx logs that:
- would work without any extra software (i.e. - best if without "logrotate")
- would create rotated files with names based on date
Best approach is something like PostgreSQL has - i.e. in it's log_filename config variable I can specify strftime-style %Y-%m-%d, and it will automatically change log on date (or time) change.
Another approach from apache - sending logs via pipe to rotatelogs program.
As far as I was able to search - no such approach exists. All I can do, is to use logrotate with dateext option, but it has it's own set of drawbacks, and I'd rather use something that works like |rotatelogs or log_filename in PostgreSQL.
© Server Fault or respective owner