Q:

how to take backup log file before its overwritten by other log file?

I have two log files: abc.log and abc.log_old. When abc.log is full, it will override into abc.log_old files. But I am not sure when it will be full and the size of log file is not fixed. The log file is from a different system.
My requirement is to take the backup of abc.log_old file, before it's overwritten by abc.log file. How can take the backup log file before it's overwritten by other log file?

A:

Don't reinvent the wheel. This is a job for logrotate.

