Simple rsyslog Configuration

From MythTV Official Wiki
Revision as of 17:53, 21 May 2012 by Sphery (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

rsyslog is an implementation of syslog. This page provides basic information on configuring rsyslog for use with MythTV, but additional information can be found on the rsyslog web site and wiki.

Simple rsyslog Configuration

This configuration uses a simple approach to logging which separates log lines into different files based on application name. This approach has the benefit that it allows logging to any desired syslog facility and will prevent non-MythTV application logging from getting into MythTV log files (even if another service or application uses the same syslog facility). This configuration assumes that all MythTV applications use syslog logging. This is done by specifying the command-line argument --syslog <facility> to all MythTV applications, for example:

mythbackend --syslog local7

To use the configuration, place the configuration file at /etc/rsyslog.d/40-mythtv.conf, create/update the initial log files with appropriate ownership and permissions, restart rsyslogd, then start MythTV applications with --syslog local7. The commands to create/update the initial log files are given, below, for easier copy/paste (permissions, here, are appropriate for Ubuntu-based systems--change owner and group, as required, for your system):

sudo install -d -m0755 -o syslog -g adm /var/log/mythtv
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythbackend.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythfrontend.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythjobqueue.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythmediaserver.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythtv-setup.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythfilldatabase.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythcommflag.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythpreviewgen.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythtranscode.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythmetadatalookup.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythutil.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythwelcome.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythshutdown.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythmessage.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythlcdserver.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythccextractor.log
sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythavtest.log


Author unknown
Description Example configuration file for using rsyslog for MythTV application logging.
Supports Version25.png  



Script.png /etc/rsyslog.d/40-mythtv.conf

# Begin /etc/rsyslog.d/40-mythtv.conf

# While rsyslog should be able to create the required directories and files,
# existing directories and files will not be updated with required ownership
# and permissions. Therefore, to ensure this logging configuration works,
# regardless of existing log files, the required directories and files should
# be updated with appropriate permissions before starting rsyslog. The
# following commands can be used to do this (with permissions, here, given
# for use on Ubuntu-based systems--change owner and group, as required, for
# your system):
#
# sudo install -d -m0755 -o syslog -g adm /var/log/mythtv
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythbackend.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythfrontend.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythjobqueue.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythmediaserver.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythtv-setup.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythfilldatabase.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythcommflag.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythpreviewgen.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythtranscode.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythmetadatalookup.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythutil.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythwelcome.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythshutdown.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythmessage.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythlcdserver.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythccextractor.log
# sudo install -m0644 -o syslog -g adm /dev/null /var/log/mythtv/mythavtest.log

# Make MythTV logs readable by world
$FileCreateMode 0644

# Send all logging from MythTV applications to application-specific log files.
if $programname == 'mythbackend' then /var/log/mythtv/mythbackend.log
& ~
if $programname == 'mythfrontend' then /var/log/mythtv/mythfrontend.log
& ~
if $programname == 'mythjobqueue' then /var/log/mythtv/mythjobqueue.log
& ~
if $programname == 'mythmediaserver' then /var/log/mythtv/mythmediaserver.log
& ~
if $programname == 'mythtv-setup' then /var/log/mythtv/mythtv-setup.log
& ~
if $programname == 'mythfilldatabase' then /var/log/mythtv/mythfilldatabase.log
& ~
if $programname == 'mythcommflag' then /var/log/mythtv/mythcommflag.log
& ~
if $programname == 'mythpreviewgen' then /var/log/mythtv/mythpreviewgen.log
& ~
if $programname == 'mythtranscode' then /var/log/mythtv/mythtranscode.log
& ~
if $programname == 'mythmetadatalookup' then /var/log/mythtv/mythmetadatalookup.log
& ~
if $programname == 'mythutil' then /var/log/mythtv/mythutil.log
& ~
if $programname == 'mythwelcome' then /var/log/mythtv/mythwelcome.log
& ~
if $programname == 'mythshutdown' then /var/log/mythtv/mythshutdown.log
& ~
if $programname == 'mythmessage' then /var/log/mythtv/mythmessage.log
& ~
if $programname == 'mythlcdserver' then /var/log/mythtv/mythlcdserver.log
& ~
if $programname == 'mythccextractor' then /var/log/mythtv/mythccextractor.log
& ~
if $programname == 'mythavtest' then /var/log/mythtv/mythavtest.log
& ~

# Set FileCreateMode back to default.  This should be the same value as specified
# in the /etc/rsyslog.conf file.
$FileCreateMode 0640

# End /etc/rsyslog.d/40-mythtv.conf