I am trying to logrotate every 15 minutes a CDR file consisting of multiple CDR records, where each CDR record is present in a new line, all works fine but logrotate truncates the file in the middle of last CDR record which results in breaking latest CDR record across 2 files.

Is there a way/option to tell logrotate to only truncate the file after it sees the newline character so that no CDR record is truncated in the middle?


  • 1
    You might add your logrotate configuration related to this file, so that everyone can see what is happening. – Thomas N Nov 11 '16 at 15:48
  • /traces/CDRs/cdr.txt { missingok rotate 1 size=50M copytruncate compress postrotate /traces/CDRs/rename.sh & endscript } – Ravi Nov 13 '16 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.