Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd vlogger(8) #65
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Looks good! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
xtraeme
Apr 5, 2017
Member
|
I agree too. This is a great idea. Thanks.
El 4/4/2017 22:18, "Chris Brannon" <notifications@github.com> escribió:
… Looks good!
I'd love to see this merged.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#65 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA0fqeRcHlwAkot9k7Rrf7eq4UzFDEWOks5rsqWtgaJpZM4MQGst>
.
|
vlogger.c
| #include <syslog.h> | ||
| #include <unistd.h> | ||
| typedef struct _code { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
vlogger.c
| 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); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
vlogger.c
| } | ||
| if (access("/etc/vlogger", X_OK) != -1) | ||
| execl("/etc/vlogger", "/etc/vlogger", tag, (char *)0); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bougyman
Apr 5, 2017
Member
|
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 ***@***.***> 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=on 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 VLOGGER(8)
NAME
vlogger – 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 tag as
only argument and replaces vlogger.
If vlogger is executed as a log service for runit or another daemontools
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 each 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 replaces
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 ***@***.***>
LICENSE
vlogger is in the public domain.
To the extent possible under law, the creator of this work has waived 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:
#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
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#65>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAawFEBvrbVoJqAKSs99zyoZ8ciZmVuks5rhcjagaJpZM4MQGst>
.
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
chneukirchen
Apr 5, 2017
Contributor
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. ;)
|
I don't see how 100 loc .c can be overkill for something like this. ;) |
Duncaen
added some commits
Apr 5, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
CMB
Apr 16, 2017
Contributor
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.
|
I found a couple more issues with vlogger in its current state. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
the-maldridge
Jul 26, 2017
Member
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.
|
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. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Looks like this issue fell off the radar. |
CMB
and others
added some commits
Apr 16, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Duncaen
Jun 3, 2018
Contributor
@CMB thanks for the reminder, merged your changes and did a few cleanups to not exit if anything related to getting the service name from the cwd. This should allow to set the tag via the t flag.
It checks if tag is initialized after opt parsing and exits if its not set via either cwd or options.
|
@CMB thanks for the reminder, merged your changes and did a few cleanups to not exit if anything related to getting the service name from the cwd. This should allow to set the tag via the t flag. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Duncaen
Jun 3, 2018
Contributor
@the-maldridge not sure about the license, the choice was made because everything else in this repository is already in the public domain.
|
@the-maldridge not sure about the license, the choice was made because everything else in this repository is already in the public domain. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
the-maldridge
Jun 3, 2018
Member
@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.
![]()
|
@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.
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Merged in the new repository. |
Duncaen commentedMar 1, 2017
•
edited
Edited 1 time
-
Duncaen
edited Mar 1, 2017 (most recent)
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=onmode which would work, but somevoid 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 services.