Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

thegeekstuff has an example about logrotate. copytruncate will copy and truncate the original log file. Then why we should use create? The original log file has not been removed.

/tmp/output.log {
        size 1k
        compresscmd /bin/bzip2
        compressext .bz2
        rotate 4
        maxage 100

Another question is what is the use of maxage 100? The rotate 4 directive will delete old log files after 4 rotation.

share|improve this question
Yes, that doesn't make sense and man logrotate even says so: "copytruncate: [...] When this option is used, the create option will have no effect, as the old log file stays in place." – Ulrich Schwarz Mar 5 '12 at 8:16
up vote 27 down vote accepted

That is probably a mistake, it is found only in one example on that tutorial. All other examples have copytruncate without the create option. Also logrotate man page says that is will be actually ignored:


Truncate the original log file to zero size in place after creating a copy, instead of moving the old log file and optionally creating a new one. It can be used when some program cannot be told to close its logfile and thus might continue writing (appending) to the previous log file forever. Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost. When this option is used, the create option will have no effect, as the old log file stays in place.

Regarding maxage, I think it can be useful for example for logfiles which can be empty for few roration periods (days/weeks/months) - if you use notifempty, empty logfile will not be rotated, so you can have too old rotated files still in place.

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.