I've had a few recent offline questions about rotatelogs that surprisingly hit this same limitation I hadn't seen before.
Currently, without a post-rotate program, you can't have a different behavior for truncation of the initial log file and rotated log files. Either both are truncated or neither are. This means a config like error_log.%d (day of month) is not really usable, because you will either lose data during a restart or end up with January 1 and Feb 1 in the same file. Is it reasonable to add a -T for "truncate all but the initial file" or is this too confusing for its value? This would allow e.g. bin/rotatelogs -T error_log.%d ... which gives you a nice sliding month long window that doesn't require external cleanup -- it's an example I'd like to add. Same for day of week -- you don't want logs from all Tuesdays, but when you restart, you don't want to truncate. This would also replace some of the "misuse" of the confusing -n I added that is very prickly to make intuitive without -t. -- Eric Covener cove...@gmail.com