Commit Graph

709 Commits

Author SHA1 Message Date
Joachim Nilsson
08b6c6fd0f man: Sync FreeBSD syslog.conf.5 man page w/ limitations in sysklogd
The FreeBSD syslogd has more priority matching features and can also
group rules per program/hostname logging.  The sysklogd project does
not yet support this, so that is removed and instead the syntax and
examples are better described.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-09 13:22:46 +01:00
Joachim Nilsson
881fd52acc man: Sync FreeBSD syslogd man page with the realities of the project
Add missing -r option for log rotation and remove -8 option, which we
don't have yet.

Add SECURITY, DEBUGGING, and SIGNALS sections and expand upon the BUGS
section a bit to link things together.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-09 13:22:46 +01:00
Joachim Nilsson
9262229cc8 syslogd: Add log format and remote port to debug listing of sinks
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-09 13:22:46 +01:00
Joachim Nilsson
ede638e9fd Travis-CI: Disable clang temporarily for Coverity Scan run
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-08 00:06:22 +01:00
Joachim Nilsson
e8a91c870a Remove last traces of klogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-08 00:06:12 +01:00
Joachim Nilsson
e15d789c84 Fix #9: Open kernel log pipe after daemonizing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 20:58:16 +01:00
Joachim Nilsson
3462e2ba19 syslogd: Remove debug fprintf() from 6e6c0dd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 20:58:16 +01:00
Joachim Nilsson
f46850b000 syslogd: Refactor backgrounding/daemonization w/ code from FreeBSD
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 20:58:16 +01:00
Joachim Nilsson
a3f3ed1833
Merge pull request #10 from kraj/master
Fix build on non-glibc linux systems
2019-12-07 20:09:07 +01:00
Khem Raj
d3d18505d0 include sys/types.h for off_t
Fixes
error: unknown type name 'off_t'

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2019-12-07 10:33:14 -08:00
Khem Raj
095052c601 Remove __BEGIN_DECLS/__END_DECLS
The __BEGIN_DECLS and __END_DECLS are internal identifiers in glibc and
are not defined in any standard. Using them fails build on musl
libc, its better to avoid them

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2019-12-07 10:33:14 -08:00
Joachim Nilsson
1d5c71c6d9 man: Adapt FreeBSD syslogd.8 to the flags and history of sysklogd
- Much less command line options (for now)
- Mention support for RFC3164 and RFC5424
- Add the history of the sysklogd project

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 12:36:14 +01:00
Joachim Nilsson
6d567764ca Update with information on new license, 3-clause BSD
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 11:11:23 +01:00
Joachim Nilsson
c6c696a722 Slight formatting changes for GitHub license detection
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 11:07:21 +01:00
Joachim Nilsson
b07393c426 Update ChangeLog with license change
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 11:05:02 +01:00
Joachim Nilsson
51ff440b99 Relicense project under the 3-clause BSD license
With `klogd` removed and the original man pages replaced with FreeBSD
versions, the only remaining GPL'ed material was the build system, which
the copyright owner (undersigned) agrees to change to BSD as well.
Hence, the GNU GPL could be dropped in favor of the 3-clause BSD.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 11:04:00 +01:00
Joachim Nilsson
899d0d28be Relicense configure.ac and Makefile.am's under 3-clause BSD
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 10:57:47 +01:00
Joachim Nilsson
17cf953b97 Import pristine FreeBSD versions of man pages for license change
This patch replaces the original man pages by Greg and Martin, that were
both licensed under the GNU GPL, with 3-clause BSD licensed versions of
the same man pages from FreeBSD.

- syslogd.8     FreeBSD Subversion r335862
- syslog.conf.5 FreeBSD Subversion r314436

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 10:49:36 +01:00
Joachim Nilsson
5780d330fd Prepare ChangeLog for the next major release of sysklogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 10:32:49 +01:00
Joachim Nilsson
ca4f4c47e4 Update README with the removal of klogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 10:31:06 +01:00
Joachim Nilsson
fd2721598b Update version information and change date for man pages
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 10:31:06 +01:00
Joachim Nilsson
6bb6672ebf Remove klogd from the sysklogd project
This patch removes one of the traditionally key pieces of the sysklogd
project, klogd.  Now that syslogd performs logging of kernel messages
we no longer require a separate daemon for that.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 10:31:06 +01:00
Joachim Nilsson
8aa2060312 Fix #8: kernel messages duplicated to console
When building the sysklogd project --without-klogd we must disable the
kernel logging to console on Linux.  This fix depends on how the sysctl
setting `kernel.printk` is configured.  The patch only calls the kernel
to set console_loglevel to minimum_console_loglevel.

See the kernel docs for details:

  https://www.kernel.org/doc/Documentation/sysctl/kernel.txt

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-07 10:30:42 +01:00
Joachim Nilsson
a7fe2ef700 Use correct define in #ifdef, __linux__ not linux
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:26:39 +01:00
Joachim Nilsson
73736adbfd Bump version for v2.1 release cycle
The changes in the timer handling are quite extensive, so we cannot in
good conscience call this a patch release.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:24:38 +01:00
Joachim Nilsson
9cf1f97cef Fix nasty parallel build problem reported by Gentoo and Westermo
Independently of each other both the Gentoo project and Westermo found
an issue with massively parallel builds on monster-core-machines.  At
Westermo there are 40 core Xeon monsters that stumble when building
sysklogd.

The Gentoo bug report is here:

    https://bugs.gentoo.org/701894

The problem stems from strlcat.c and strlcpy.c being used for both
the libcompat convenience library built for libsyslog and als for
syslogd when the system does not have either of the APIs in libc,
i.e. most Linux systems with GLIBC or musl libc.

I can either rewrite the Makefile.am files to handle dependencies
better, or we just disable parallel build like this patch. There's
too few source files to gain anything from parallel build anyway.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:19:05 +01:00
Joachim Nilsson
3f94ae2906 man: Fix formatting of interval / 2
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:15:04 +01:00
Joachim Nilsson
7b122449cc test: Increase run time for -- MARK -- test
We should make sure to also check that we don't get more MARK messages
than expected based on the -mMIN value.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:13:55 +01:00
Joachim Nilsson
6e6c0ddfaa syslogd: Integrate new timer API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:13:15 +01:00
Joachim Nilsson
5ac6c39687 syslogd: Add generic timer API to replace exising buggy one
This patch adds a alarm()/SIGALRM based generic timer API to syslogd.
The API takes care to wrap SIGALRM and serialize all timer events to
a standard UNIX pipe(2) which syslogd can poll() for like any other
incoming event.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-05 20:38:43 +01:00
Joachim Nilsson
ad686ca86d Update ChangeLog and bump version for v2.0.3 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 21:40:20 +01:00
Joachim Nilsson
55f2122393 release: Make sure distcheck runs --with-klogd
Otherwise the resulting tarball will not include klogd.8

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 21:22:01 +01:00
Joachim Nilsson
163aa84cc4 klogd: Add '-F' as alias for '-n', for compat with syslogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 21:17:02 +01:00
Joachim Nilsson
f6713bdb84 syslogd: Increase granularity of background flush/mark timer
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 21:12:54 +01:00
Joachim Nilsson
799b03447a test: Add --MARK-- test to verify idle functionality works
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 21:12:02 +01:00
Joachim Nilsson
4556901a2b syslogd: Update documentation, -m interval is in minutes
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 15:59:35 +01:00
Joachim Nilsson
f4c01a3ba3 syslogd: Refactor domark() timer handling, always run at TIMERINTVL
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-30 17:55:58 +01:00
Joachim Nilsson
77119e2625 test: stop.sh: Exit on first error
We want to catch regressions when syslogd dies before we can tell it to
exit.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
c3acff5fae syslogd: Only Initialize syslogd once
This bug caused syslogd to fall back to logging to /dev/console for
internal log messages/errors during reconfiguration at runtime.

syslogd has the FreeBSD style of keeping already open log files ready
for logging until re:init() has completed, when new log files are rolled
in and any old ones not to be used anymore are closed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
a9758d1559 syslogd: Record time of first occurrence of a message
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
0a8cecfa84 syslogd: Handle DNS lookup of unknown remote hosts in domark()
Refactor of nslookup of unknown remote syslog servers, both when
(re)reading the .conf file and at runtime.  This means we retry
DNS lookup every 30 sec, or INET_SUSPEND_TIME +/- 30 sec.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
90dd1b1c37 syslogd: Always domark() timer, regardless of -mfoo value
The domark() timer handles a lot of the critical maintenance action in
syslogd, it must always be guaranteed to run.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
280b5fd3ec syslogd: Fix blocking of SIGHUP/ALRM during logmsg()
Only block signals *after* all sanity checking of log message has been
completed, otherwise we will end up with blocked SIGHUP and SIGALRM.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
05c5b6752d syslogd: Always create PID file, even in debug mode
We definitely want to be able to run syslogd in debug mode for extended
periods of time and still run under finit/systemd or similar, letting
users know we run as 'PID'.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
8e255b7f9d syslogd: Only set debugging_on in Debug (-d) mode
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 15:27:52 +01:00
Joachim Nilsson
b7d4225ef1 syslogd: Retry address lookup forever, never give up
When logging to a remote server, using @fqdn syntax in syslog.conf,
syslogd calls getaddrinfo() to resolve the IP address.  Older versions
of syslogd gave up after 10 retries.  We want to retry forever since we
may be running in a setup with bad network connection to the DNS server
for longer periods of time.

This patch only removes the 'give up' mechanism, which unfortunately
reused the f_prevcount value, which in turn could cause that value to
become -1 and thus trigger an assert().  With this code out of the way,
and the type change in the previous commit, the counter can never again
be negative.

Note: The configurable suspend time before trying again remains at its
default of 3 minutes.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 14:53:07 +01:00
Joachim Nilsson
49e168601e syslogd: Change f_prevcount type; int --> size_t
If it wraps around to zero we want to log the message anyway.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 14:39:12 +01:00
Joachim Nilsson
90a993f5a2 Update ChangeLog and bump version for v2.0.2 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 10:08:03 +01:00
Joachim Nilsson
1d8fe4944d syslogd: Reset prevcount in fprintlog_first() to prevent assert()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 10:00:34 +01:00
Joachim Nilsson
3d4b8cb84d syslogd: Improve log messages on error, eg. INET sendto()
When we fail sending to a remote host, help admin debug the issue by
stating which remote we failed to send to.

Also minor changes to other similar error messages, use same form.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 09:38:22 +01:00