Search code examples
rsynclogrotate

rsync and logrotate transfers old logs every day


I have Apache web server producing considerable amount of log files. I do logrotate them every day on the server. Every night I rsync server backups over Internet to another computer.

The speedup of log files sync is very close to 1, because logrotate renames all the files and rsync treat them as totally different, because they really are.

I guess this is common problem, what tools would you recommend me to use. I want to keep some history of logs (like 50 days) on the server and whole log history on backup. The night job should only transfer logs from last day.


Solution

  • Use the dateext option in logrotate:

    Archive old versions of log files adding a daily extension like YYYYMMDD instead of simply adding a number.