Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
}
share|improve this question

migrated from stackoverflow.com Oct 13 '12 at 19:16

This question came from our site for professional and enthusiast programmers.

    
Do you experience this only with log-files, or have you other file-corruptions as well? –  Nils Oct 13 '12 at 20:27

1 Answer 1

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'

share|improve this answer
    
copytruncate is there - so the copy will be a new file-handle. –  Nils Oct 13 '12 at 20:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.