Logrotate - mythfrontend

From MythTV Official Wiki
Jump to: navigation, search

For most distros, save the configuration file to /etc/logrotate.d/mythfrontend

Log rotation with --logpath logging

This configuration will work with standard MythTV logging using the --logpath argument.


Author unknown
Description Example configuration file for using logrotate to rotate your mythfrontend log files when using --logpath.
Supports Version25.png  


Script.png /etc/logrotate.d/mythfrontend

/var/log/mythtv/mythfrontend*.log {
        weekly
        rotate 8
        missingok
        ifempty
        nocreate
        nocompress
        sharedscripts
        olddir /var/log/mythtv/old
        postrotate
                killall -HUP mythfrontend
                killall -HUP mythlcdserver
                find /var/log/mythtv/old -name 'mythfrontend*' -type f -mtime +30 -delete
        endscript
}   


Log rotation with --syslog logging

This logrotate configuration will only work with specific log file names. If you use the --logpath argument to mythfrontend, the log file name will include date and process ID information, meaning it will be different for each run of mythfrontend. Therefore, this approach can only be used if you configure mythfrontend to use syslog logging and configure syslog to use static file names.


Author unknown
Description Example configuration file for using logrotate to rotate your mythfrontend log files when using --syslog.
Supports Version25.png  


Script.png /etc/logrotate.d/mythfrontend

/var/log/mythtv/mythfrontend.log {
        weekly
        rotate 8
        missingok
        notifempty
        compress
        compresscmd /usr/bin/bzip2
        uncompresscmd /usr/bin/bunzip2
        compressext .bz2
        delaycompress
        sharedscripts
        postrotate
                /bin/kill -HUP `pidof mythfrontend 2> /dev/null` 2> /dev/null || true
        endscript
}