The Geek Stuff 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.

  • 4
    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." Commented Mar 5, 2012 at 8:16
  • 2
    maxage 100 will delete rotated files when they become over 100 days old and the current file is rotated; even when fewer than 4 rotated files exist. Commented Nov 18, 2016 at 18:28

1 Answer 1


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 states that It 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 rotation 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.

  • Please help me to get an answer to my question also serverfault.com/questions/997734/… Commented Jan 6, 2020 at 3:49
  • I just noticed that the Tomcat package for Ubuntu (6/14 & 8/18) bundles a logrotate conf that includes both copytruncate and create .... Baffling!
    – Jimadine
    Commented Jun 8, 2020 at 17:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .