Simple syslog-ng Configuration

From MythTV Official Wiki
Revision as of 06:56, 30 August 2012 by Drakkan11 (talk | contribs) (Simple syslog-ng configuration for MythTV)

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

Syslog-ng is an open source implementation of the syslog protocol. This page provides basic information on configuring syslog-ng for use with MythTV, but additional information can be found on the homepage and wiki.

Simple syslog-ng 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). Only the mythlogserver will save all log lines from the other MythTV applications into its logfile.

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

The syslog-ng configuration file is structured into five parts.

options {...}
source src {...}
log (connect filters and destinations)

Add the following MythTV destinations below the already defined destinations:

destination mythbackend        { file("/var/log/mythtv/mythbackend.log"); };
destination mythfrontend       { file("/var/log/mythtv/mythfrontend.log"); };
destination mythfilldatabase   { file("/var/log/mythtv/mythfilldatabase.log"); };
destination mythcommflag       { file("/var/log/mythtv/mythcommflag.log"); };
destination mythpreviewgen     { file("/var/log/mythtv/mythpreviewgen.log"); };
destination mythmetadatalookup { file("/var/log/mythtv/mythmetadatalookup.log"); };
destination mythlogserver      { file("/var/log/mythtv/mythlogserver.log"); };

Add the new MythTV filter definitions below the already defined filters:

filter f_mythbackend        { facility("local7") and match("mythbackend" value("MESSAGE")); };
filter f_mythfrontend       { facility("local7") and match("mythfrontend" value("MESSAGE")); };
filter f_mythcommflag       { facility("local7") and match("mythcommflag" value("MESSAGE")); };
filter f_mythpreviewgen     { facility("local7") and match("mythpreviewgen" value("MESSAGE")); };
filter f_mythmetadatalookup { facility("local7") and match("mythmetadatalookup" value("MESSAGE")); };
filter f_mythfilldatabase   { facility("local7") and match("mythfilldatabase" value("MESSAGE")); };
filter f_mythlogserver      { facility("local7") and match("mythlogserver" value("MESSAGE")); };

And finally add the MythTV logging definitions below the already defined ones:

log { source(src); filter(f_mythbackend);        destination(mythbackend); };
log { source(src); filter(f_mythfrontend);       destination(mythfrontend); };
log { source(src); filter(f_mythfilldatabase);   destination(mythfilldatabase); };
log { source(src); filter(f_mythcommflag);       destination(mythcommflag); };
log { source(src); filter(f_mythpreviewgen);     destination(mythpreviewgen); };
log { source(src); filter(f_mythmetadatalookup); destination(mythmetadatalookup); };
log { source(src); filter(f_mythlogserver);      destination(mythlogserver); };

Then restart syslog-ng and start MythTV applications with --syslog local7. The logfiles should be created automatically.