ABillS log rotation

Since some ABillS log files gradually increased in size, I wrote a script to rotate these logs.

Let’s create a log rotation configuration file:

/etc/logrotate.d/abills

Here’s an example script:

/usr/abills/var/log/event_asterisk.log {
    daily
    rotate 1
    compress
    delaycompress
    missingok
    notifempty
    create 0666 www-data root
}

/usr/abills/var/log/extreceipt.log {
    daily
    rotate 2
    compress
    delaycompress
    missingok
    notifempty
    create 0644 www-data www-data
}

Since the files had different rights and owners, I specified them for each file separately.
For some files, rotation may not be required, for example, the paysys_check.log payment history, you can manually make a copy of this file for the archive, and clear the current one, for example, in this way:

cd /usr/abills/var/log/
ls
echo "" > paysys_check.log

See my other articles about ABillS
Configuring logrotate to rotate logs

Leave a comment

Leave a Reply