Proper way to rotate Nginx logs
- by depesz
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.