Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Counting in octal is just like counting in decimal--if you don't use your thumbs. -- Tom Lehrer


devel / comp.lang.python / Re: Getting Syslog working on OSX Monterey

SubjectAuthor
o Re: Getting Syslog working on OSX MontereyPeter J. Holzer

1
Re: Getting Syslog working on OSX Monterey

<mailman.211.1646587743.2329.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17399&group=comp.lang.python#17399

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-pyt...@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: Getting Syslog working on OSX Monterey
Date: Sun, 6 Mar 2022 18:28:59 +0100
Lines: 111
Message-ID: <mailman.211.1646587743.2329.python-list@python.org>
References: <CADoNktU6JPX00wDf9asFVr=NpTAy1ruRn_pHnLunc91M9_sokA@mail.gmail.com>
<0D40B574-2975-49BD-9E97-9055317169E5@barrys-emacs.org>
<20220228214109.ntoihdobzf5naqrx@hjp.at>
<4EAF5AC0-446D-4493-AFF0-2FD8A8889439@barrys-emacs.org>
<20220304212307.bd3rj67m6gaej37a@hjp.at>
<64FFB4FB-F4BD-4E1A-AAC7-792A26D65EB6@barrys-emacs.org>
<20220306172859.kirgy6zgpagbkkon@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="vhxrlxbrbzhsxvli"
X-Trace: news.uni-berlin.de pEjwOUe7CwJP0t9F+SZUFg/5D/CxbnlYyRlL2XDNoJYw==
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(e.g.': 0.05; '3.6': 0.05;
'content-type:multipart/signed': 0.05; 'parameter': 0.05; 'mar':
0.07; '"just': 0.09; 'content-type:application/pgp-signature':
0.09; 'debian': 0.09; 'filename:fname piece:asc': 0.09;
'filename:fname piece:signature': 0.09;
'filename:fname:signature.asc': 0.09; 'it)': 0.09; 'linux': 0.09;
'locally': 0.09; 'macos': 0.09; 'mechanism': 0.09; 'messages.':
0.09; 'reasons:': 0.09; 'yes.': 0.09; 'log': 0.12; 'import': 0.15;
'"creative': 0.16; '(rfc': 0.16; '2022,': 0.16; '__/': 0.16;
'api.': 0.16; 'aside': 0.16; 'barry': 0.16; 'challenge!"': 0.16;
'complexity.': 0.16; 'constructor': 0.16; 'destination.': 0.16;
'everywhere,': 0.16; 'from:addr:hjp-python': 0.16;
'from:addr:hjp.at': 0.16; 'from:name:peter j. holzer': 0.16;
'hjp@hjp.at': 0.16; 'holzer': 0.16; 'logs': 0.16; 'missing?':
0.16; 'reality.': 0.16; 'rewrite': 0.16; 'setup.': 0.16;
'specify': 0.16; 'stross,': 0.16; 'subject:OSX': 0.16;
'subject:working': 0.16; 'targets.': 0.16; 'url-
ip:212.17.106.137/32': 0.16; 'url-ip:212.17.106/24': 0.16; 'url-
ip:212.17/16': 0.16; 'url:hjp': 0.16; 'useful.': 0.16; 'windows.':
0.16; '|_|_)': 0.16; 'wrote:': 0.16; 'python': 0.16; 'api': 0.17;
'instead': 0.17; 'probably': 0.17; "can't": 0.17; 'to:addr:python-
list': 0.20; "i'd": 0.24; '(and': 0.25; 'saying': 0.25; 'seems':
0.26; 'configure': 0.26; 'port': 0.26; "isn't": 0.27; 'local':
0.27; 'bit': 0.27; 'function': 0.27; 'etc': 0.28; 'sense': 0.28;
'seem': 0.31; 'default': 0.31; 'think': 0.32; "doesn't": 0.32;
'but': 0.32; 'package': 0.34; 'header:In-Reply-To:1': 0.34;
'running': 0.34; 'yes,': 0.35; 'files': 0.36; 'those': 0.36;
'missing': 0.37; 'really': 0.37; 'using': 0.37; 'means': 0.38;
'two': 0.39; 'adding': 0.39; 'least': 0.39; 'single': 0.39;
'safe': 0.39; 'use': 0.39; 'break': 0.39; 'case.': 0.40; 'want':
0.40; 'should': 0.40; 'likely': 0.61; 'forward': 0.62;
'received:212': 0.62; 'remote': 0.63; 'send': 0.63; 'apple': 0.64;
'received:userid': 0.66; 'accept': 0.67; 'adds': 0.69;
'remaining': 0.69; 'url-ip:212/8': 0.69; 'extra': 0.84;
'control.': 0.84; 'disagree': 0.84; 'platforms.': 0.84;
'received:at': 0.84; 'scott': 0.84; 'upgrades': 0.84; 'broke':
0.91; 'exists': 0.91; 'routing': 0.91; 'hidden': 0.95
Content-Disposition: inline
In-Reply-To: <64FFB4FB-F4BD-4E1A-AAC7-792A26D65EB6@barrys-emacs.org>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <20220306172859.kirgy6zgpagbkkon@hjp.at>
X-Mailman-Original-References: <CADoNktU6JPX00wDf9asFVr=NpTAy1ruRn_pHnLunc91M9_sokA@mail.gmail.com>
<0D40B574-2975-49BD-9E97-9055317169E5@barrys-emacs.org>
<20220228214109.ntoihdobzf5naqrx@hjp.at>
<4EAF5AC0-446D-4493-AFF0-2FD8A8889439@barrys-emacs.org>
<20220304212307.bd3rj67m6gaej37a@hjp.at>
<64FFB4FB-F4BD-4E1A-AAC7-792A26D65EB6@barrys-emacs.org>
 by: Peter J. Holzer - Sun, 6 Mar 2022 17:28 UTC
Attachments: signature.asc (application/pgp-signature)

On 2022-03-05 16:25:38 +0000, Barry Scott wrote:
> On 4 Mar 2022, at 21:23, Peter J. Holzer <hjp-python@hjp.at> wrote:
> > If you are saying that SysLogHandler should use a system specific
> > default (e.g. "/dev/log" on Linux) instead of UDP port 514 everywhere, I
> > agree 99 % (the remaining 1 % is my contrarian alter ego arguing that
> > that's really the distribution maintainer's job since a Linux
> > distribution might use some other socket).
> >
> > If you are saying it should use the libc syslog routines, I disagree for
> > at least two reasons: a) they are OS specific, b) you can't configure the
> > destination. So that would remove useful functionality.
> >
> > In any case it seems strange to me that you want to rewrite it just to
> > avoid passing a single parameter to the constructor (or - more likely -
> > adding a single line to a config file).
>
> What I am used to is a setup where programs use syslog() to log and
> a dameon like rsyslog is responsible for routing the logs to local files
> and/or remote systems.

Yes, that's a pretty common setup.

> On a modern linux I think the route is syslog() -> journald. And you
> can have syslog() -> journald -> rsyslogd.

Yes. Journald accepts syslog (RFC 5424) protocol on /dev/log and can
optionally forward messages to another syslog daemon (but only via Unix
sockets, AFAICS, not via UDP or TCP). rsyslog is then configured to
accept those forwarded messages (and may also be configured to accept
messages on port 514, but this isn't the case by default on Debian or
Ubuntu).

> 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@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).
>
> >
> >> What you do not see used in the SyslogHandler() is the import syslog
> >> and hence its nor using openlog() etc from syslog API.
> >
> > For good reasons. The C syslog API is missing important functionality.
>
> What are you think about being missing? Just curious.

As I already wrote:

* System independence. The libc syslog(3) function (and the Python
syslog package using it) exists only on Unix-like OSs. Not Windows.
Probably not some embedded platforms. SyslogHandler works on all
platforms with networking.
* Configurable targets. The SyslogHandler allows you to specify where to
send the messages. syslog(3) does not. So with syslog(3) you always
need a locally running daemon. In containers or embedded systems this
might add extra unnecessary complexity.

> As an aside if I had the need to log into a system log mechanism I'd be
> looking to use the jounald API so that I can use structured logging on linux
> systems.

That might be useful. Journald already adds a bit of extra information
to messages received over the syslog, but using the API directly would
probably give the user more control.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)
1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor