Re: [voidlinux/void-runit] Add vlogger(8) (#65)

Chris Brannon at Tue, 04 Apr 2017 13:18:53 -0700
Looks good! I'd love to see this merged.
Juan RP at Tue, 04 Apr 2017 21:30:45 -0700
I agree too. This is a great idea. Thanks. El 4/4/2017 22:18, "Chris Brannon" <notifications@github.com> escribi=C3=B3= : > Looks good! > I'd love to see this merged. > > =E2=80=94 > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/voidlinux/void-runit/pull/65#issuecomment-291619616= >, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AA0fqeRcHlwAkot9k7Rr= f7eq4UzFDEWOks5rsqWtgaJpZM4MQGst> > . > -- = You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/voidlinux/void-runit/pull/65#issuecomment-291751257=
Christian Neukirchen at Wed, 05 Apr 2017 06:06:22 -0700
chneukirchen commented on this pull request. > @@ -0,0 +1,111 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <syslog.h> +#include <unistd.h> + +typedef struct _code { Don't use identifiers starting with _ in code. > + if (strcmp(cp->c_name, s) == 0) + *facility = cp->c_val; + } +} + +int +main(int argc, char *argv[]) +{ + char c, *p; + int facility = LOG_DAEMON; + int level = LOG_INFO; + + if (((p = strrchr(*argv, '/')) && !strncmp(p+1, "run", 3)) && + (*p = 0, (p = strrchr(*argv, '/')) && !strncmp(p+1, "log", 3)) && + (*p = 0, (p = strrchr(*argv, '/'))) != 0) { + tag = strdup(p+1); unchecked strdup > + (*p = 0, (p = strrchr(*argv, '/')) && !strncmp(p+1, "log", 3)) && + (*p = 0, (p = strrchr(*argv, '/'))) != 0) { + tag = strdup(p+1); + } + + while ((c = getopt(argc, argv, "p:t:")) != -1) + switch (c) { + case 'p': strpriority(optarg, &facility, &level); break; + case 't': tag = optarg; break; + default: + fprintf(stderr, "usage: vlogger [-p priority] [-t tag]\n"); + exit(1); + } + + if (access("/etc/vlogger", X_OK) != -1) + execl("/etc/vlogger", "/etc/vlogger", tag, (char *)0); Do we want to fall back to the default if this execl fails?
bougyman at Wed, 05 Apr 2017 06:11:04 -0700
I really think this is overkill, as proper logging services are already supported by runit. as part of sv-helper I include rsvlog which is meant to be symlinked as <service>/log/run, and it allows some handy configuration of svlogd. Take a look and let me know what you think. It's what i've been using for logging with runit services for > 8 years. Tj On Wed, Mar 1, 2017 at 11:36 AM, Duncan Overbruck <notifications@github.com> wrote: > vlogger(8) is a alternative to logger(1), by default it sends messages > from stdin to syslog. > > The main reason to replace logger(1) is, that logger only connects once to > the syslog socket in default mode and puts all messages into the void if > syslog is not running at the time. > logger(1) has a new --socket-errors=3Don mode which would work, but some > void uses don't use syslog at all and in this case the log service would > constantly restart. > > As a bonus vlogger(8) looks for /etc/vlogger and if its executable it > just executes it and is replaced by it. > This can be used to avoid syslog and just write all logs to files with > svlogd(8) as example without having to edit all log files for each > service. > > VLOGGER(8) System Manager's Manual VLOGG= ER(8) > > NAME > vlogger =E2=80=93 log messages to syslog or an arbitrary executable > > SYNOPSIS > vlogger [-p priority] [-t tag] > > DESCRIPTION > By default, vlogger reads lines from stdin and sends them to syslog.= If > the file /etc/vlogger exists and is executable it is executed with t= ag as > only argument and replaces vlogger. > > If vlogger is executed as a log service for runit or another daemont= ools > like supervision suit it uses the service name as default tag. As > example if vlogger is linked to /var/service/foo/log/run it uses foo= as > default tag. > > -p priority > The. priority can be facility.level or just facility. See > FACILITIES, LEVELS or syslog(3). The default is daemon.info. > > -t tag Defines the openlog(3) ident which is used as prefix for eac= h log > message or passed as first argument to /etc/vlogger. > > FACILITIES > auth > authpriv > cron > daemon > ftp > kern can not be used from userspace replaced with daemon. > lpr > mail > news > syslog > user > uucp > local[0-7] > security deprecated synonym for auth. > > LEVELS > emerg > alert > crit > err > warning > notice > info > debug > panic deprecated synonym for emerg. > error deprecated synonym for err. > warn deprecated synonym for warning. > > FILES > /etc/vlogger > An optional executable file that is used to to handle the > messages. It is executed with tag as first argument and rep= laces > the vlogger process. > > EXIT STATUS > The vlogger utility exits 0 on success, and >0 if an error occurs. > > EXAMPLES > /etc/vlogger: > > #!/bin/sh > exec svlogd /var/log/$1 > > SEE ALSO > logger(1), syslog(3), svlogd(8) > > HISTORY > This program is a replacement for the logger utility provided by > util-linux. > > AUTHOR > Duncan Overbruck <mail@duncano.de> > > LICENSE > vlogger is in the public domain. > > To the extent possible under law, the creator of this work has waive= d all > copyright and related or neighboring rights to this work. > > http://creativecommons.org/publicdomain/zero/1.0/ > > Linux March 1, 2017 = Linux > > ------------------------------ > You can view, comment on, or merge this pull request online at: > > https://github.com/voidlinux/void-runit/pull/65 > Commit Summary > > - Add vlogger(8) > > File Changes > > - *M* .gitignore > <https://github.com/voidlinux/void-runit/pull/65/files#diff-0> (1) > - *M* Makefile > <https://github.com/voidlinux/void-runit/pull/65/files#diff-1> (2) > - *A* vlogger.8 > <https://github.com/voidlinux/void-runit/pull/65/files#diff-2> (138) > - *A* vlogger.c > <https://github.com/voidlinux/void-runit/pull/65/files#diff-3> (111) > > Patch Links: > > - https://github.com/voidlinux/void-runit/pull/65.patch > - https://github.com/voidlinux/void-runit/pull/65.diff > > =E2=80=94 > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/voidlinux/void-runit/pull/65>, or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAAawFEBvrbVoJqAKSs99z= yoZ8ciZmVuks5rhcjagaJpZM4MQGst> > . > --=20 You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/voidlinux/void-runit/pull/65#issuecomment-291856311=
Christian Neukirchen at Wed, 05 Apr 2017 06:16:38 -0700
`rsvlog` does not support syslog, which we currently use on void. I don't see how 100 loc .c can be overkill for something like this. ;)
Christian Neukirchen at Wed, 05 Apr 2017 12:42:28 -0700
chneukirchen approved this pull request.
Chris Brannon at Sun, 16 Apr 2017 10:35:11 -0700
I found a couple more issues with vlogger in its current state. It was possible for tag to be uninitialized. Symlinking vlogger to foo/log/run didn't work as expected, because runsv doesn't use an absolute pathname when running the service. Instead, it changes to the service directory and executes ./run. I fixed them both, on the vlogger branch of CMB/void-runit.
Michael Aldridge at Thu, 29 Jun 2017 07:50:15 +0000 (UTC)
@Duncaen can we go ahead and merge this? Sounds like you may need to pull back in some changes from @CMB first though...
Michael Aldridge at Wed, 26 Jul 2017 02:35:02 +0000 (UTC)
I'd like to open the can of worms here and ask if this can be an OSI recognized license instead of cc0. As I've learned recently cc0 is incredibly hard to deal with for US based contributors in certain states.
Chris Brannon at Sat, 02 Jun 2018 14:52:09 -0700
Looks like this issue fell off the radar.
Michael Aldridge at Sun, 03 Jun 2018 12:29:42 -0700
@Duncaen good point, I'd somehow missed that entirely. As that's a separate issue, we can handle it in another thread. At this point I've got no remaining requests for this before merge. :shipit: