Logrotate not generating all files after run

4.5k views Asked by At

Hello people

It's my first time using logrotate and I don't know if I'm configuring it in the right way. I'm using it with loggerhead log file in Ubuntu 11.04

Log is under

/log/loggerhead/loggerheadd.log

My configuration file looks like this

/log/loggerhead/loggerheadd.log {
    daily
    rotate 7
    compress
    delaycompress
    missingok
}

Then I run a force rotation

logrotate -f /etc/logrotate.d/loggerhead

and that change the name of the log file to

/log/loggerhead/loggerheadd.log.1

And didn't create the original file (loggerheadd.log) again, so I couldn't run a new force rotation, because "the file doesn't exist".

So, it's supposed that the application write entries in "loggerheadd.log" but when logrotate run the file will be renamed, so where will be written the log entries? Am I missing something?

Hope you can help me

1

There are 1 answers

0
Gerrat On

By default logrotate will just rename your files, so your old file will be gone.

You can either use the create option to create a new file after the old one is used, or copytruncate to copy the original file to one with a new name, then truncate the original. Either option will do what you're asking for (more details on the man page here)