dhcpcd icon indicating copy to clipboard operation
dhcpcd copied to clipboard

Allow logging to stderr only/disabling syslog

Open capezotte opened this issue 4 years ago • 1 comments

I have dhcpcd running on a machine whose system processes are managed by runit.

The preferred logging mechanism for runit (and some other service managers like daemontools and s6) is for stderr to be programmatically piped to a second process which will then prepend timestamps, save them to disk (one folder for each service), perform log rotation when necessary, etc.

Classic syslog is supported only with external programs, which means extra setup is required for what comes "for free" with the stderr + processor combo (stream separation, guarantee of the sender's identity, etc.).

dhcpcd does support logging to stderr, and I've enabled it, but then the logged stderr becomes redudant with saved syslog contents. Working with the -qq option, which is intended to solve this issue if I understood the comments in the code correctly, introduces the already mentioned drawbacks.

A simple patch XORing out LOGERR_LOG from logopts in the dhcpcd.c right before the getopt loop on line 1940 has solved this problem for me. I'm not sure if it has any side-effects, or, if my request is accepted, what the name of the option could be.

capezotte avatar Nov 06 '21 21:11 capezotte

We could turn off syslog if a third -q was given or we could just compile out syslog support entirely. The only syslog call is in line 245 in logerr.c

rsmarples avatar Nov 12 '21 15:11 rsmarples