Cause of the problem
It finally turned out that I had previously created /var/log/local5.log with an inappropriate owner and group ( root:root ). They were inappropriate because /etc/rsyslog.conf indicates explicitly to the owner and group should be syslog:syslog :
# # Set the default permissions for all log files. # $FileOwner syslog $FileGroup adm $FileCreateMode 0640 $DirCreateMode 0755 $Umask 0022 $PrivDropToUser syslog $PrivDropToGroup syslog
Unfortunately, other rsyslog log rsyslog should take care (e.g. auth.log ) were also root:root , so as you can see from ls -lah , mine were no different from others ... (which is also empty, I wonder why such a non-functional configuration set by default).
Unfortunately, rsyslog does not record any errors (or at least I did not find where).
Additional information that may be useful to complete rsyslog configuration
As a side note, rsyslog expects a special format for the messages it receives, and if not, it adds some default data (timestamp node name). You can modify them. Anyway, from my python script, I decided to send the message only to the log and let rsyslog format the output. So finally, the relevant parts of my logging configuration file are:
formatters: rsyslogdFormatter: format: '%(filename)s: %(funcName)s: %(message)s' handlers: mainHandler: class: logging.handlers.SysLogHandler level: INFO formatter: rsyslogdFormatter address: '/dev/log' facility: 'local5' loggers: __main__: level: INFO handlers: [mainHandler]
And I added a custom template to /etc/rsyslog.conf :
$template MyappTpl,"%$now% %timegenerated:12:23:date-rfc3339% %syslogtag%%msg%\n"
and accordingly modified by /etc/rsyslog.d/40-local.conf :
local5.* /var/log/local5.log;MyappTpl
I also want to mention that the documentation provided by the corresponding package ( rsyslog-doc for ubuntu) corresponds to the installed version, of course, and contains tips that I did not find in the online documentation.