Getting Syslog working on OSX Monterey

Barry barry at barrys-emacs.org
Sun Mar 6 17:11:30 EST 2022



> On 6 Mar 2022, at 19:38, Peter J. Holzer <hjp-python at hjp.at> wrote:
> 
> On 2022-03-06 18:28:59 +0100, Peter J. Holzer wrote:
>>> On 2022-03-05 16:25:38 +0000, Barry Scott wrote:
>>> Using the syslog() function means that any platform/distro details are
>>> hidden from the user of syslog() and as is the case of macOS it
>>> "just works".
>> 
>> That doesn't seem to be case. Philip Bloom reported in
>> <CADoNktVgU9DBdBfc5wJe4vhJcTKrdVQjdeUO8eN=BvTw9g48fw at mail.gmail.com>,
>> that syslog in Python 3.6 broke in OS X Monterey. So even using
>> syslog(3) doesn't seem to be safe across upgrades (no, I don't know
>> how Apple managed to break this - as I wrote, I don't use OS X).
>> 
>> 
>>> (I assume, not checked, that the write to the socket does not work
>>> because Apple is not implementing the syslog protocol from the RFC).
> 
> I noticed that RFC 5424 describes a very different protocol from RFC
> 3164 and was curious which one SysLogHandler implements.
> 
> Surprise: Neither.

So the logging code works by accident…

> 
> It just sends the PRI part and the MSG part. While that neatly sidesteps
> the question of which of the two incompatible header formats to use,
> it's not a a valid syslog message in either format.
> 
> Obviously Linux accepts this format (the timestamp and the hostname are
> kind of redundant anyway when you're using a unix socket).
> 
> I strongly suspect that the OS X syslog daemon got stricter and now
> insists on properly formatted messages.

Interesting. If I can find a spare hour I can play with this.

Barry

> 
>        hp
> 
> 
> -- 
>   _  | Peter J. Holzer    | Story must make more sense than reality.
> |_|_) |                    |
> | |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
> __/   | http://www.hjp.at/ |       challenge!"
> -- 
> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list