Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

migrated from 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

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


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