wiki:Logrotate

Version 3 (modified by krit, 3 years ago) (diff)

--

Logrotate

[krit@Mosh ~]$ more /etc/logrotate.d/actdaslog 
/tmp/ActDasLog/*.log
{
        su krit krit
        #size 500k
        rotate 7
        daily
        missingok
        notifempty
        delaycompress
        compress
        postrotate
             touch /tmp/ActDasLog/mosq_feed_actDas_11_firmware.log
             chown krit:krit /tmp/ActDasLog/mosq_feed_actDas_11_firmware.log
        endscript
}

To run the logroate file with

[root@Mosh logrotate.d]# logrotate -f /etc/logrotate.d/actdaslog --state /tmp/logrotate-state --verbose

After run we should see

[krit@Mosh ActDasLog]$ tree /tmp/ActDasLog/
/tmp/ActDasLog/
├── mosq_feed_actDas_11_firmware.log
├── mosq_feed_actDas_11_firmware.log.1
├── mosq_feed_actDas_11_firmware.log.2.gz
├── mosq_feed_actDas_11_firmware.log.3.gz
└── mosq_feed_actDas_11_firmware.log.4.gz

0 directories, 5 files
[krit@Mosh ActDasLog]$