Commit Graph

841 Commits

Author SHA1 Message Date
Joachim Wiberg
9e9c1c884a Fix #57: garbled tag name in std log file output
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-12 14:30:19 +02:00
Joachim Wiberg
6bc8525a8d Ensure both logger and syslogd output the same version string
Slight differences in output when called with `-v` flag:

  - Should output to stdout, that's what people expect (not an error)
  - Should output *project* name and version, for syslogd this is not
    so obvious since it *logs* 'syslogd vx.y.z' while the version is
    'sysklogd vx.y.z'

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 13:17:01 +02:00
Joachim Wiberg
7850591388 Update ChangeLog and bump version for v2.4.2 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 12:57:13 +02:00
Joachim Wiberg
7bd017be0a logger: fix default log severity info -> notice, like other loggers
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 12:48:31 +02:00
Joachim Wiberg
a2ff3a93f6 libsyslog: drop extra leading space in message
When logging to a file we want a space to separate proc[pid]: from the
message, but for regular logging local/remote we don't want to inject
an extra space.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 12:37:19 +02:00
Joachim Wiberg
22ee326192 logger: drop trailing space when reading message from command line
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 12:28:59 +02:00
Joachim Wiberg
16bad57af5 Update ChangeLog and bump version for v2.4.1 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 11:46:32 +02:00
Joachim Wiberg
a06639bd0e libsyslog: bump ABI version, changes/additions to interface
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 11:45:33 +02:00
Joachim Wiberg
51ecc21973 man: update syslogp.3 with latest changes for remote logging
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 11:34:55 +02:00
Joachim Wiberg
460e26f0f2 man: update change date and copyright years on logger.1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 11:34:55 +02:00
Joachim Wiberg
4fdbb64c51 libsyslog: honor LIB_PTRIM when logging to stderr
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 11:34:55 +02:00
Joachim Wiberg
221ae0abe0 libsyslog: avoid opening+connecting to syslogd when LOG_NLOG
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 11:34:55 +02:00
Joachim Wiberg
4c39bfeccb Reorder man pages links and add logger(1)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-08-01 09:49:58 +02:00
Joachim Wiberg
87ff7d6901 test: verify remote logging in logger tool
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 22:56:16 +02:00
Joachim Wiberg
911e3f05a1 test: allow logger() to run w/o UNIX socket path
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 22:49:37 +02:00
Joachim Wiberg
43d8640aac libsyslog: enforce 32 char limit on RFC3164 output to remote syslogd
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 18:48:39 +02:00
Joachim Wiberg
50f6ad74cb syslogd: ensure tag is <= 32 chars for RFC3164 output
This may cause a bit of a regression for some users, but the RFC is
crystal clear on this point, the tag MUST NOT exceed 32 characters.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 18:48:26 +02:00
Joachim Wiberg
3969dbb8a6 Update with new details on the logger tool
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 17:32:36 +02:00
Joachim Wiberg
c095131ff9 man: update logger(1), it can log to remote servers now
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 17:32:13 +02:00
Joachim Wiberg
5662afe2c0 Adjust log file output format in BSD mode to output proc[PID] too
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 17:17:25 +02:00
Joachim Wiberg
0811315f35 Bump version and update ChangeLog w/ last fixes before next release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 12:56:50 +02:00
Joachim Wiberg
8b513ade8e Fix log option flag: LOG_RFC3154 -> LOG_RFC3164
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 12:54:25 +02:00
Joachim Wiberg
7f4dcff60d Updates on project origin and naming
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 12:48:52 +02:00
Joachim Wiberg
f0b7b6fdf8 Merge branch 'master' into dev 2022-07-31 12:29:29 +02:00
Joachim Wiberg
70bfb8ed98 Handle gettimeofday() errors the same way everywhere
Problem found by Coverity Scan.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 12:21:23 +02:00
Joachim Wiberg
4f94756bf2 logger: add support for -I PID to log, e.g., $$ from a shell script
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 12:03:57 +02:00
Joachim Wiberg
f32ca837c1 logger: add support for -H NAME to override system hostname
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 11:48:58 +02:00
Joachim Wiberg
c7f65e11c9 logger: minor, coding style (reverse Christmas tree)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 11:44:29 +02:00
Joachim Wiberg
ea1762d5f5 man: update logger(1) with new options for remote logging and format
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 10:46:32 +02:00
Joachim Wiberg
1fc5c174f1 logger: update usage text with new options
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 10:41:25 +02:00
Joachim Wiberg
c8fe229cfc logger: add support for RFC3164 style (for remote) logging
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 10:16:01 +02:00
Joachim Wiberg
5d98f06718 logger: drop debug logs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-31 10:14:57 +02:00
Joachim Wiberg
dfb654688a logger: initial support for logging to a remote host
This is the first RFC5424 (only) support for for logging to a remote
host.  The syntax continues to follow the FreeBSD logger.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-29 14:53:23 +02:00
Joachim Wiberg
1044669b8d test: notify sometimes fail, need to wait for syslogd to rotate
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-29 14:53:03 +02:00
Joachim Wiberg
3086637768 libsyslog: fix loss of logger messages on failed connect()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-29 14:37:46 +02:00
Joachim Wiberg
ef67ecae12 Update ChangeLog for upcoming v2.4.1 bugfix release
Also, restore ChangeLog entry for released v2.4.0.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-26 09:16:29 +02:00
Joachim Wiberg
daba6cce09 Fix #5&: failure to reset socket count on SIGHUP
As reported on GitHub. When logging to a remote host, after a few
SIGHUP's we get the following log message:

     Only 16 IP addresses per socket supported.

When closing all currently open sockets, the socket count must be reset
to allow for opening new ones, otherwise we'll run out of "counts".
Yes, this should be refactored to use the FreeBSD model implementation.

Problem introduced in v2.4.0, commit 075815e.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-26 07:47:09 +02:00
Joachim Wiberg
e41721216c Drop repology badge(s)
No need to advertise that sysklogd is not kept up-to-date in all the
distros on the planet.  Nothing much I can do about it.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-07-21 21:06:31 +02:00
Joachim Wiberg
34c812415d
Merge pull request #53 from meta-ed/hexencoding
Prevent logfile corruption by control codes

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-06-17 18:17:53 +02:00
Joachim Wiberg
2d37cf2c28
Merge pull request #52 from meta-ed/overread
Prevent overread when scanning the message buffer

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-06-17 18:16:28 +02:00
Edward K. McGuire
bcc3c7c1fb Prevent logfile corruption by control codes
Do not corrupt logfiles when kernel messages contain control codes,
notably \n. Instead, preserve the kernel's protective C-style hex
encoding. For example, \n embedded in a message by a kernel-level
facility is received as "\x0a". Kernel-level facilities cannot be
trusted to use only syslog-safe codes in kernel messages. See:
<https://kernel.org/doc/Documentation/ABI/testing/dev-kmsg>
2022-06-16 15:52:04 -05:00
Edward K. McGuire
9427734546 Prevent overread when scanning the message buffer
This change avoids the possibility of advancing past the null
terminator, by always testing the value at the pointer before
advancing the pointer.

While repairing this, I reconciled the code sections that read the
priority, sequence, and timestamp, so that they handle the pointer in
exactly the same way. This makes the source easier to maintain.
2022-06-16 14:33:34 -05:00
Joachim Wiberg
8f83328850 Fake usec timestamp for RFC3164 messages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-06-05 16:43:20 +02:00
Joachim Wiberg
1e9f164198 Fake usec timestamp for untrusted kernel log messages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-06-04 18:55:14 +02:00
Joachim Wiberg
4bbed71c29 Move debian/ dir to separate branch to ease packaging downstream
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 19:32:23 +02:00
Joachim Wiberg
7dc4783af8 .github: install valgrind also for release build
We call `make distcheck` in the release build, so the tests run.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 18:41:45 +02:00
Joachim Wiberg
eafde9550d Update ChangeLog and bump version for v2.4.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 18:27:48 +02:00
Joachim Wiberg
dfc32d7843 Fix memory leak on exit
Only to clean up, possibly relevant for no-MMU systems, but
they have other issues as well (e.g. fork) that prevent them
from using the sysklogd project.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 16:59:50 +02:00
Joachim Wiberg
7ff4a7d210 test: reduce verbosity of new test
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 16:59:32 +02:00
Joachim Wiberg
715c52dc21 .github: prefix test logs with current compiler
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 16:24:34 +02:00