Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Send some filthy mail.


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

SubjectAuthor
o Re: Getting Syslog working on OSX MontereyBarry Scott

1
Re: Getting Syslog working on OSX Monterey

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: bar...@barrys-emacs.org (Barry Scott)
Newsgroups: comp.lang.python
Subject: Re: Getting Syslog working on OSX Monterey
Date: Thu, 3 Mar 2022 18:32:55 +0000
Lines: 128
Message-ID: <mailman.131.1646332383.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>
<CADoNktXBX6B8YLvoh7xOb20+O8O7Gyk4yvoDOE8CXUBFmC=1_g@mail.gmail.com>
<D82E0307-3B57-41F2-A356-D557337A0188@barrys-emacs.org>
Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\))
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de m4Q2y9g+6qq5PvIlalXc6g/FP6fBeXGaI+iGGsgX407A==
Return-Path: <barry@barrys-emacs.org>
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; '(which': 0.04; 'yet.':
0.04; '2022': 0.05; 'debug': 0.07; 'mar': 0.07; 'modules': 0.07;
'cc:addr:python-list': 0.09; 'fedora': 0.09; 'from:addr:barry':
0.09; 'macos': 0.09; 'myself.': 0.09; 'received:217.70': 0.09;
'received:gandi.net': 0.09; 'received:mail.gandi.net': 0.09;
'rfc': 0.09; 'log': 0.12; '&gt;': 0.14; 'cc:no real name:2**0':
0.14; 'import': 0.15; 'url:mailman': 0.15; 'that.': 0.15;
'"creative': 0.16; '(more': 0.16; '2022,': 0.16; '__/': 0.16;
'api.': 0.16; 'assuming': 0.16; 'barry': 0.16; 'challenge!"':
0.16; 'command.': 0.16; 'from:addr:barrys-emacs.org': 0.16;
'from:name:barry scott': 0.16; 'had,': 0.16; 'hjp@hjp.at': 0.16;
'holzer': 0.16; 'indeed': 0.16; 'logs': 0.16; 'message-id:@barrys-
emacs.org': 0.16; 'reality.': 0.16; 'replying,': 0.16;
'reproduce': 0.16; 'server,': 0.16; 'stross,': 0.16;
'subject:OSX': 0.16; 'subject:working': 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; '|_|_)': 0.16; 'wrote:':
0.16; 'feb': 0.17; 'probably': 0.17; 'uses': 0.19; 'implement':
0.19; 'cc:addr:python.org': 0.20; 'written': 0.22; 'mac': 0.22;
'code': 0.23; 'cc:2**1': 0.23; 'run': 0.23; 'list,': 0.24; 'url-
ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'depends': 0.25; 'url:listinfo': 0.25; 'url-ip:188.166/16': 0.25;
'library': 0.26; 'port': 0.26; 'suspect': 0.26; 'else': 0.27;
'local': 0.27; 'function': 0.27; 'etc': 0.28; 'expect': 0.28;
'output': 0.28; 'sense': 0.28; 'suggest': 0.28; 'wrong': 0.28;
'this?': 0.29; 'default': 0.31; 'url-ip:188/8': 0.31; 'program':
0.31; "doesn't": 0.32; 'corporation': 0.32; 'guess': 0.32; 'but':
0.32; "i'm": 0.33; 'there': 0.33; 'same': 0.34; 'mean': 0.34;
'work.': 0.34; 'header:In-Reply-To:1': 0.34; 'running': 0.34;
'definitely': 0.35; 'fine': 0.35; 'mon,': 0.36; "skip:' 10": 0.37;
'using': 0.37; 'engineering': 0.37; 'url-ip:13.107/16': 0.38;
'way': 0.38; 'thanks': 0.38; 'changes': 0.39; 'quite': 0.39;
'added': 0.39; 'least': 0.39; 'handle': 0.39; 'use': 0.39;
'seeing': 0.39; 'define': 0.40; 'exact': 0.40; 'want': 0.40;
'should': 0.40; 'services': 0.61; 'connection': 0.61; 'forward':
0.62; 'remote': 0.63; 'skip:b 10': 0.63; 'pass': 0.64; 'apple':
0.64; 'your': 0.64; 'produce': 0.65; 'url:instagram': 0.65;
'look': 0.65; 'years': 0.65; 'url:png': 0.66; 'shows': 0.67;
'received:217': 0.67; 'live': 0.68; 'know.': 0.68; 'deeply': 0.69;
'skip:/ 10': 0.69; 'url-ip:212/8': 0.69; 'skip:f 20': 0.75;
'experts': 0.76; 'os.': 0.84; 'scott': 0.84; 'wherever': 0.91;
'will,': 0.91
In-Reply-To: <CADoNktXBX6B8YLvoh7xOb20+O8O7Gyk4yvoDOE8CXUBFmC=1_g@mail.gmail.com>
X-Mailer: Apple Mail (2.3693.60.0.1.1)
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
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: <D82E0307-3B57-41F2-A356-D557337A0188@barrys-emacs.org>
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>
<CADoNktXBX6B8YLvoh7xOb20+O8O7Gyk4yvoDOE8CXUBFmC=1_g@mail.gmail.com>
 by: Barry Scott - Thu, 3 Mar 2022 18:32 UTC

> On 3 Mar 2022, at 03:01, Philip Bloom <philip.bloom@applovin.com> wrote:
>
> I'm probably asking on the wrong list, and probably should bother wherever apple's ASL experts live for changes in monterey. Guess nobody else is seeing this?
>
> The same exact code is working just fine on OSX Big Sur, but on OSX Monterey it doesn't work at all. Users that haven't updated are having the program produce logs as it has for years through logging.handlers.SysLogHandler. Mac OSX definitely has a listening socket at '/var/run/syslog' which shows up in Console.app.
>
> Apologies, Barry. I'm not quite understanding your responses.

This works:

syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_USER)
syslog.syslog(syslog.LOG_NOTICE, 'QQQ test log')

I see the "QQQ test log" when I run syslog command.

And I can reproduce that logging.handlers.SysLogHandler does not work.
I added debug to the SysLogHandler() code and see that it does indeed write into the /var/run/syslog socket.
I suspect that macOS /var/run/syslog does not implement the RFC that this code depends on, but that a wild guess.

I suggest that you write your own handler that uses syslog.syslog() and use that.

Barry

>
> When we say OSX has no listener for Syslog, what is the Apple System Log and the general output to Console.app then? I thought that was the local syslog on OSX and had, for years, been behaving as such when using logging.handlers.SysLogHandler with a config in /etc/asl/ to define how it should be routed and the rollover/cleanup frequency.
>
> Thanks for replying, just having trouble understanding.
>
>
> On Mon, Feb 28, 2022 at 2:07 PM Barry Scott <barry@barrys-emacs.org <mailto:barry@barrys-emacs.org>> wrote:
>
>
> > On 28 Feb 2022, at 21:41, Peter J. Holzer <hjp-python@hjp.at <mailto:hjp-python@hjp.at>> wrote:
> >
> > On 2022-02-27 22:16:54 +0000, Barry wrote:
> >> If you look at the code of the logging modules syslog handle you will see that
> >> it does not use syslog. It’s assuming that it can network to a syslog listener.
> >> Such a listener is not running on my systems as far as I know.
> >>
> >> I have always assumed that if I want a logger syslog handler that I would have
> >> to implement it myself. So far I have code that uses syslog directly and have
> >> not written that code yet.
> >
> > What do you mean by using syslog directly? The syslog(3) library
> > function also just sends messages to a "syslog listener" (more commonly
> > called a syslog daemon) - at least on any unix-like system I'm familiar
> > with (which doesn't include MacOS). It will, however, always use the
> > *local* syslog daemon - AFAIK there is no standard way to open a remote
> > connection (many syslog daemons can be configured to forward messages to
> > a remote server, however).
>
> I'm re-reading the code to check on what I'm seeing. (Its been a long
> time since I last look deeply at this code).
>
> You can write to /dev/log if you pass that to
> SysLogHandler(address='/dev/log'), but the default is to use a socket
> to talk to a network listener on localhost:514. There are no deamons
> listening on port 514 on my Fedora systems or mac OS.
>
> That is not what you would expect as the default if you are using the C
> API.
>
> What you do not see used in the SyslogHandler() is the import syslog
> and hence its nor using openlog() etc from syslog API.
>
> Barry
>
>
>
> > hp
> >
> > --
> > _ | Peter J. Holzer | Story must make more sense than reality.
> > |_|_) | |
> > | | | hjp@hjp.at <mailto:hjp@hjp.at> | -- Charles Stross, "Creative writing
> > __/ | http://www.hjp.at/ <http://www.hjp.at/> | challenge!"
> > --
> > https://mail.python.org/mailman/listinfo/python-list <https://mail.python.org/mailman/listinfo/python-list>
>
> --
> https://mail.python.org/mailman/listinfo/python-list <https://mail.python.org/mailman/listinfo/python-list>
>
>
> --
> Philip Bloom
> Director, Services Engineering
> AppLovin Corporation
> M: (786)-338-1439 <tel:786-338-1439>
> <https://www.linkedin.com/company/applovin> <https://twitter.com/AppLovin> <https://facebook.com/AppLovin> <https://www.instagram.com/applovin/>
> <https://www.applovin.com/>
>
>
>

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor