Commit Graph

829 Commits

Author SHA1 Message Date
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
Joachim Nilsson
0e6c141f4f Fix #6: Add workaround for systems with vanilla/older autoconf
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-26 21:42:36 +01:00
Joachim Nilsson
87cef2d268 Update ChangeLog and bump version for v2.0.1
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-25 14:06:47 +01:00
Joachim Nilsson
84b7acf55f Allow --prefix= to install to /sbin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-25 12:50:09 +01:00
Joachim Nilsson
15b8d386b3 Expand directories for configuration summary
Unexpanded defaults:

  sysconfdir  => ${prefix}/etc
  runstatedir => ${localstatedir}/run

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-25 12:14:18 +01:00
Joachim Nilsson
7793fcbd14 Fix #3: Don't guess PID file location, use configure --runstatedir
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-24 18:52:31 +01:00
Joachim Nilsson
4396004fba Add missing '-k' and '-T' command line flags to getopt()
Fixes GitHub issue #2

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-24 18:38:26 +01:00
Joachim Nilsson
b80a225f73 Minor, simplify previous commit and add logger on/off to summary
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-18 17:54:35 +01:00
Joachim Nilsson
076bd964cf
Merge pull request #1 from Polynomial-C/optional_logger
build: make logger and its man page optional
2019-11-18 17:39:00 +01:00
Lars Wendler
227008ec0f
build: make logger and its man page optional
There are other packages that provide a logger program like util-linux
We should respekt that

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
2019-11-18 12:36:25 +01:00
Joachim Nilsson
b22e1339c9 Update ChangeLog and bump version for v2.0 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 11:16:09 +01:00
Joachim Nilsson
c2061b8f53 Add workaround for systemd unit files in distcheck
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 11:07:46 +01:00
Joachim Nilsson
7937cd0f55 test: Include new fwd.sh test in dist
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 11:07:28 +01:00
Joachim Nilsson
e45d7d0671 test: No need to export MSG variable
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 11:07:15 +01:00
Joachim Nilsson
c7122811fb Remove files that are no longer needed
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 10:08:14 +01:00
Joachim Nilsson
ac8b8ebf0d klogd.8: Remove wording on role and superiority over syslogd
For most use-cases a kernel with CONFIG_KALLSYMS and a stand-alone
syslogd is sufficient.  No need for the complexity of klogd.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 09:59:18 +01:00
Joachim Nilsson
49968d977e syslogd.8: Update section on SECURITY and .conf differences
- We have the -a PEER and -s to limit exposure to remote attacks
- Mention include file syntax in .conf file differences section
- Mention SECURITY section in BUGS, there are countermeasures

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 09:44:15 +01:00
Joachim Nilsson
8dda39c382 logger.1: Clarify use of stand-alone log file
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 09:24:23 +01:00
Joachim Nilsson
245dea43bc test: Sender randomizes port, allow any in FWD test syslogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 09:11:53 +01:00
Joachim Nilsson
6bf74351c7 Final touches to ChangeLog for v2.0 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 08:58:41 +01:00
Joachim Nilsson
a2d88e732e Update feature list and add <PRI> field to logo :)
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 08:58:16 +01:00
Joachim Nilsson
f44a026d86 syslogd: Fix broken wallmsg(), off-by one iov
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 08:31:46 +01:00
Joachim Nilsson
bd5903509d syslogd: Fix RFC3164 formatting, no space after <PRI> field
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 08:26:21 +01:00
Joachim Nilsson
7343c55f6e test: Shift delay to *really* wati for tshark to start before logging
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-14 01:40:33 +01:00
Joachim Nilsson
fcded43abf test: Add FWD test, two syslog daemons, a custom port and RFC5424
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-14 01:36:41 +01:00
Joachim Nilsson
eb524bf8da syslogd: Minor man page update after last command line change
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-14 01:20:00 +01:00
Joachim Nilsson
09f6b7bf6c syslogd: Minor, don't log to console when exiting ...
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 19:13:49 +01:00
Joachim Nilsson
54edca09d9 syslogd: Close open UNIX and inet sockets on SIGTERM
When creating Inet sockets we may get multiple struct addrinfo records.
With this patch we support up to 16 records per Internet peer.  When
closing we iterate over all peers and all records.

Refactor socket_close() to clean up any lingering socket path when
closing UNIX socket.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 19:11:34 +01:00
Joachim Nilsson
4192e543a5 syslogd: Use common nomenclature for next pointer
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 18:44:01 +01:00
Joachim Nilsson
6350bf2474 syslogd: Fix invalid free(), found by Valgrind
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 18:44:01 +01:00
Joachim Nilsson
b0ff1aa5c7 Travis-CI: Fix build w/o messing up example code build
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 17:54:35 +01:00