1

Here is my script:

/var/log/libbitcoin/*.log {
    size 5M
    missingok
    rotate 0
    compress
    delaycompress
    notifempty
    create 644 bs bs
    sharedscripts
}

For some reason it is creating debug.log.1 whereas I just want it to delete the file. What am I doing wrong?

2
  • 1
    What do you get if you run logrotate -d /path/to/your/config/above?
    – Jeff Schaller
    Commented Aug 7, 2016 at 18:27
  • Ah OK, I didn't know about this option. Thank you. Commented Aug 8, 2016 at 9:07

2 Answers 2

1

Running with -d shows that there is a conflict due to delaycompress, which says compress the last-but-one log, when rotate 0 says there should be no such log.

Since you do not keep any old logs, simply remove the compress and delaycompress options.

0
-1

In following code you can see the files will be deleted after period of time depends on which cron job, you simply can modify it by adding size file to it

find /var/log -name "*.log-*" -mtime +1 -exec rm -f {} \;

find /var/log -name "*.gz" -mtime +1 -exec rm -f {} \;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .