This special build option enabled reading syslog messages from stdin on
syslogd. It also disabled all other standard features of syslogd, which
made it a bit too far from the real thing.
A better approac is to start syslogd with -p /tmp/foo and let a test
application, e.g. logger -u /tmp/foo, connect using the standard UNIX
domain socket API.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This massive patch brings support for parsing incoming syslog messages,
remote or local, to determine if format is RFC5424 or the older RFC3164.
For logging syslogd currently defaults to RFC3164 for local files and
supports RFC5424 for sending to remote servers.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
We want to use -b for binding to an address:port, like FreeBSD/NetBSD
supports using this option. Unfortunately breaks existing setups in
the wild already.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
We don't need to carry it any longer. Anyone who wants to read them can
access an older GIT version, or released tarball.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The '-n' option is commonly used for remote servers, so let's
consolidate the log rotation under the '-r' flag instead, with
the same syntax as previously established in syslog.conf
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch merges the upstream NetBSD syslog.[ch], which adds syslogp()
family of APIs to support RFC5424. This API will first go into use in
the logger tool, klogd, and syslog_tst, then it will also be exposed
as libsyslog and syslog/syslog.h for end-users.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
- Add empty lines for readability, after return before new statement and
after variable declarations
- Remove explicit typecasting, NULL is NULL regardless of type
- Remove unnecessary braces and else
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
When a user links with syslog.c, or the future libsyslog, they may still
use the standard GLIBC header files. GLIBC redirects syslog() to the
__syslog_chk() definition early on, but a user may not notice when a
simple non-optimized (-O0 or none) program is compiled.
This currently does not affect musl libc.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The -fomit-frame-pointer is part of the standard optimization flags in
-O1 and above, so no need to enable it explicitly.
For reference https://lkml.org/lkml/2003/2/26/158
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
- Let syslog_tst.c use local syslog.c API, for wrapping
- Add -DTESTING to build of syslog_tst & C:o
- Enable CLOEXEC on each opened log file in syslog.c
- Simplify code for readability
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
For compatibility with GLIBC <2.19 we only need to define _BSD_SOURCE,
and for compatibility with GLIBC >=2.19 we must defined _DEFAULT_SOURCE.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
On modern systems, both *BSD and Linux using GLIBC/musl, the signal's
disposition is not reset to SIG_DFL on invocation of its handler. On
Linux this is true because GLIBC/musl wraps signal() in sigaction()
with the same semantics as BSD.
A follow-up commit will refactor to use sigaction().
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
We always want to build with support for UNIX domain socket and remote
syslog (both receive and send). We can safely state that all systems
we aim to target supports FHS.
Also, start clean up gratuitous use of SYSV #ifdefs.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
No need to check for SYSV (?) to include fcntl.h since syslogd.c already
includes it unconditionally. If this turns out to be an actual problem
we should probe for fcntl.h in configure and use #ifdef HAVE_FCNTL_H.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch introduces a relicensed logit from the Finit[1] project. It
has been rebranded as logger to complement the features implemented in
the sysklogd project.
Note, logger conflicts with the tool of the same name from util-linux.
[1]: https://github.com/troglobit/finit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>