Re: slapd logs to syslog during tests

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: slapd logs to syslog during tests
Date: 2023-03-17 05:43:17
Message-ID: 20230317054317.fxikkv7q26aklnj2@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2023-03-16 23:52:04 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > I got sidetracked trying to make slapd stop any and all syslog access, but it
> > doesn't look like that's possible. But working on commiting the logfile-only
> > approach now. Planning to backpatch this, unless somebody protests very soon.
>
> Sadly, buildfarm seems to be having some indigestion with this ...

Unfortunately even just slightly older versions don't have the logfile-only
option :(.

For a bit I thought we were out of options, because 'loglevel 0' works, but
I was not seeing any contents in the logfile we specify. But as it turns out,
the logfile we (before this patch already) specify, don't contain anything
ever, because:
logfile <filename>
Specify a file for recording slapd debug messages. By default these messages only go to stderr, are not recorded anywhere else, and are
unrelated to messages exposed by the loglevel configuration parameter. Specifying a logfile copies messages to both stderr and the logfile.
and
loglevel <integer> [...]
Specify the level at which debugging statements and operation statistics should be syslogged (currently logged to the syslogd(8) LOG_LOCAL4

yet using logfile-only does prevent things from ending up in syslog.

Because it's not at all confusing that a 'loglevel' option doesn't influence
at all what ends up in the file controlled by 'logfile'.

Given that 'loglevel 0' works and doesn't actually reduce the amount of
logging available, that seems to be the way to go.

Iff we actually want slapd logging, the stderr logging can be turned on (and
potentially redirected to a logfile via logfile or redirection). But
unfortunately it seems that the debug level can only be set on the server
commandline. And has a significant sideeffect:
-d debug-level
Turn on debugging as defined by debug-level. If this option is specified, even with a zero argument, slapd will not fork or disassociate
from the invoking terminal

Which means the server can't be started anymore as we do currently do, we'd
have to use IPC::Run::start. I hacked that together locally, but that's more
than I think I can get right at my current level of tiredness.

So unless somebody has a better idea, I'm gonna replace 'logfile-only on' with
'loglevel 0' for now. I also am open to reverting and trying again tomorrow.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2023-03-17 05:53:46 Re: logical decoding and replication of sequences, take 2
Previous Message vignesh C 2023-03-17 05:34:00 Re: logical decoding and replication of sequences, take 2