[mythtv-users] logging

Stephen Worthington stephen_agent at jsw.gen.nz
Sat Mar 11 08:39:24 UTC 2023


On Sat, 11 Mar 2023 13:51:24 +0800, you wrote:

>Hi
>I had a single (very) bad recording and with help here I spulunked the logs ...
>So I decided to clean up the logging, I followed 
>https://www.mythtv.org/wiki/Simple_rsyslog_Configuration <https://www.mythtv.org/wiki/Simple_rsyslog_Configuration>
>
>jam        679     1  0 13:27 ?        00:00:00 /usr/local/bin/mythbackend --syslog local7
>
>(I have built from src and do not have a mythtv user)
>
>but. no logging happens
>
>? mythbackend.service - MythTV backend service
>     Loaded: loaded (/etc/systemd/system/mythbackend.service; enabled; vendor preset: disabled)
>     Active: active (running) since Sat 2023-03-11 13:37:15 AWST; 19s ago
>   Main PID: 920 (mythbackend)
>      Tasks: 43 (limit: 4915)
>        CPU: 244ms
>     CGroup: /system.slice/mythbackend.service
>             ??920 /usr/local/bin/mythbackend --syslog local7
>
>[seagull] /var/log/mythtv [2009]% ll
>total 0
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythavtest.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythbackend.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythccextractor.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythcommflag.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythfilldatabase.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythfrontend.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythjobqueue.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythlcdserver.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythmediaserver.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythmessage.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythmetadatalookup.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythpreviewgen.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythshutdown.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythtranscode.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythtv-setup.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythutil.log
>-rw-rw-rw- 1 jam users 0 Mar 11 13:23 mythwelcome.log
>
>Before I go and learn all about rsydlogd can anyone share words of wisdom
>Thanks
>James

When you set mythbackend to send to syslog, it sends the log messages
to localhost:514, where rsyslogd is listening.  Then it is up to the
rsyslogd configuration as to how the log messages are handled.  Your
mythbackend is running with "--syslog local7", which means all syslog
messages will be tagged with the "local7" value in the headers.  You
can use that value in the rsyslogd config to get all the mythbackend
messages sent to one file.  But the Ubuntu rsyslogd config uses the
program names to send the log messages to one file per name, which
matches the files seen in your /var/log/mythtv:

root at mypvr:/etc/rsyslog.d# cat 40-mythtv.conf
# Begin /etc/rsyslog.d/40-mythtv.conf

# Make MythTV logs readable by world
$FileCreateMode 0644

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

# 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

So I would recommend just putting a copy of the above 40-mythtv.conf
file in /etc/rsyslog.d if it is not already there.  If it is, then you
likely have a permissions or ownership problem on the /var/log/mythtv
directory.  In Ubuntu it looks like this:

root at mypvr:/etc/rsyslog.d# ll /var/log/mythtv -d
drwxr-sr-x 2 syslog adm 20480 Mar 11 15:10 /var/log/mythtv/

Also, in Ubuntu, all the files in /var/log/mythtv are chown
syslog:adm.  It is syslog (rsyslogd) that writes to them, not the
mythbackend program.


More information about the mythtv-users mailing list