Take the 2-minute tour ×

There's a way to do this?

share|improve this question
Can you tell us why you want to do this? Maybe there's other options... –  chmeee Aug 5 '09 at 7:01

3 Answers 3

up vote 17 down vote accepted

In your logrotate.conf (or the equivilent logrotate.d file), change the line that says "

rotate 10

(your number may be different) to a bigger number. That will tell it to keep that many days of logs. You can make it 36500, which would last you 100 years.

share|improve this answer

I've been looking for this in order to make rotation of my database backups daily, weekly and monthly; so I rotate the file daily but keep the file to do the weekly rotation, and same for the yearly rotation.

Use the copy option. From the manual:


copy Make a copy of the log file, but don’t change the original at all. This option can be used, for instance, to make a snapshot of the current log file, or when some other utility needs to truncate or parse the file. When this option is used, the create option will have no effect, as the old log file stays in place.

share|improve this answer

Setting aside the point that rotation involves deletion... ;-)

It looks like you can simply add the word 'copy' to the appropriate file (likely in /etc/logrotate.d). For example, an apache2 logrotate script would look like this:

/var/log/apache2/*.log {
    rotate 52
    		/etc/init.d/apache2 reload > /dev/null

Try that, and see if it does what you want.

share|improve this answer
Assuming that he wants the files to be "rotated" but just never deleting the old files, this won't do it. Adding "copy" to the config stanza means the original file will continue to grow forever but eventually the older copies of the file will be deleted. As I understand it, "copy" is primarily useful when you expect some other process to truncate/delete the original. –  Insyte Aug 5 '09 at 7:14
Exactly, which is what I thought he was asking for. He specifically asked for a way to "not delete my log files", not a way to "not delete old archives of my log files". Guess I should be more wary of questions that involve just a subject and no body ;-) –  Justin Ellison Aug 6 '09 at 4:02
The phrase "after rotation" provides a clue. –  Dennis Williamson Aug 15 '09 at 0:06
"Setting aside the point that rotation involves deletion..." Not necessarily. Rotation can involve just compressing the old logs and keeping them, which is what it seems the question asks for. –  reflexiv Jan 23 '13 at 22:14

Your Answer


