0

I'm working with a bunch of logs generated from a script that outputs one logfile per instance of what the script is running over. Once logfiles are generated, they are not modified or appended.

I can't find any way to simply compress and move the logfiles to the archive directory without keeping the original files around at 0 bytes.

The following config does exactly what I want, but doesn't remove the original (now 0 byte) files.

/home/queue_data/*.debug {
    size 1k
    rotate 36500
    olddir log_archive/
}

Changing rotate to 0 seems like it might do what I want, but it just deleted the contents of the logfiles and didn't compress/move it into the log_archive folder.

I understand this is a different use-case than logrotate is normally used for, but it would be nice to have a centralized system for archiving logfiles without relying on additional cleanup scripts.

Any suggestions?

1 Answers1

1

This is what the nocreate option is for:

nocreate
New log files are not created (this overrides the create option).

See also: the logrotate(8) manpage

jwodder
  • 54,758
  • 12
  • 108
  • 124