[dev] Attempt at a suckless syslog

From: Weldon Goree <weldon_AT_langurwallah.org>
Date: Fri, 18 Jul 2014 17:19:00 +0530

Hi all,

So, I got tired of trying to make sysklogd play nice with musl, and I
built this[0].

It probably needs work, but I thought I would request comments. It's the
syslog for my toy/personal obsession distro. I think it adheres to the
suckless philosophy pretty well. It opens a UNIX socket at /dev/log,
chroots to /var/log (configurable in config.def.h), reads from the
socket it opened, and writes to a series of files (again, config.def.h)
in /var/log based on the facility that is logging.

I ran into a naming issue. The word "priority" gets applied to both the
octal mask sent within < > by the library, and to the "severeness"
factor within that. Internally, I've called the string sent by the
logger "priority" and the low-order "how screwed are you?" bits
"severity" (IIRC metalog does that too).

The logd (built as "logwd" -- the -wallah/-w suffix is a symptom of my
being stationed in India -- ask a Hindi speaker) does nothing
particularly clever or impressive. It parses the priority, somewhat
modifies the format of the rest of the headers, and writes the rest to
the logfile appropriate to the logging facility (again, configurable in
config.def.h). It accepts a single command line argument: a maximum
severity level to log (defaults at LOG_WARN -- and "maximum" in that
higher-severity messages have lower severity numbers). It currently uses
daemon(3) to detach, but I'm open to an argument that your daemon
manager should do that instead. (My toy distro doesn't have a daemon
manager yet.)

I've tested it on musl-1.0.3 and glibc-2.17 (whatever comes with the
latest Slackware -- I think that's GNU and not EGLIBC), and it seems to
do what is advertised.

I don't pretend I'm a programmer, so any suggestions for improvements
will be met non-defensively.


[0]: https://github.com/weldongoree/langurwallah/tree/master/logwallah
also: there's a lot of random crap in sibling directories, so don't
bother. Except maybe for pkgwallah, which I think is a pretty cool
package manager.
Received on Fri Jul 18 2014 - 13:49:00 CEST

This archive was generated by hypermail 2.3.0 : Fri Jul 18 2014 - 14:00:11 CEST