2

I'm using logrotate to rotate my log file periodically (in my case every 1 hour checking for log file size and rotate if needed using cron). I'm facing a serious issue in it.

The following files should have been created -- user.log.gz.4, user.log.gz.3, user.log.gz.2, user.log.1, user.log.

But sometimes any one of the file goes missing, sometimes file contents are missing at the end of the file, and sometimes the content of the files are repeating. It's strange. Please can someone help me solve the issue.

My logrotate Configuration:

/var/log/project_name/*.log {
  size 512M
  copytruncate
  rotate 30
  compress
  notifempty
  missingok
}
  • Do you experience this only with log-files, or have you other file-corruptions as well? – Nils Oct 13 '12 at 20:27

1 Answers1

0

This is probably caused by some process writing to the logs while they're being rotated, you need to include a delaycompress declaration in your configuration, this sort of question is better asked in 'SuperUser' or 'ServerFault'

Gearoid Murphy
  • 428
  • 4
  • 6