title: Log to rsyslog facility from a python script
body: <p>I have this in my <code>/etc/rsyslog.conf</code>:</p>
  
  <pre><code>local0.*     /var/log/local.log
  </code></pre>
  
  <p>And I have a simple python script which reads from standard input and is supposed to send to <code>local0</code></p>
  
  <pre><code>#!/usr/bin/python3
  
  import sys, syslog
  
  syslog.openlog(ident="MY_SCRIPT", facility=syslog.LOG_LOCAL0)
  
  for line in sys.stdin:
      syslog.syslog(syslog.LOG_WARNING, f"Message\n\n")
  </code></pre>
  
  <p>But it does not work. <code>rsyslog</code> does not see the messages as comming to <code>local0</code></p>
  
  <p>Only when I change to <code>*.*</code> does rsyslog see it:</p>
  
  <pre><code>*.*     /var/log/local.log
  </code></pre>
  
  <p>I assume I don't properly configure the facility in my python script.</p>
  
  <p>How can I specify I want to log to <code>local0</code> ?</p>