2019-11-04 02:53:01 +05:30
|
|
|
```
|
2019-11-04 05:21:54 +05:30
|
|
|
.--. .--. .--.
|
|
|
|
.-----.--.--.-----| |--| :-----.-----.--| |
|
|
|
|
|__ --| | |__ --| <| | _ | _ | _ | RFC3164 :: syslogd for Linux
|
|
|
|
|_____|___ |_____|__|__|__|_____|___ |_____| RFC5424 :: w/NetBSD syslogp()
|
|
|
|
|_____| |_____|
|
|
|
|
|
2019-11-15 13:28:16 +05:30
|
|
|
<23>Aug 24 05:14:15 192.0.2.1 myproc[8710]: Kilroy was here.
|
|
|
|
<23>1 2019-11-04T00:50:15.001234+01:00 troglobit myproc 8710 - - Kilroy was here.
|
2019-11-04 02:53:01 +05:30
|
|
|
```
|
2020-09-01 02:40:39 +05:30
|
|
|
<a href="https://repology.org/project/sysklogd/versions"><img align="right" alt="Packaging status"
|
|
|
|
src="https://repology.org/badge/vertical-allrepos/sysklogd.svg"></a>
|
2019-12-07 15:39:09 +05:30
|
|
|
[![BSD Badge][]][BSD License] [![Travis Status][]][Travis] [![Coverity Status][]][Coverity Scan]
|
2019-11-04 02:54:05 +05:30
|
|
|
|
2018-08-03 02:20:06 +05:30
|
|
|
Table of Contents
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
* [Introduction](#introduction)
|
2019-11-04 10:29:54 +05:30
|
|
|
* [Using -lsyslog](#using--lsyslog)
|
2018-08-03 02:20:06 +05:30
|
|
|
* [Build & Install](#build--install)
|
|
|
|
* [Building from GIT](#building-from-git)
|
|
|
|
* [Origin & References](#origin--references)
|
|
|
|
|
|
|
|
Introduction
|
|
|
|
------------
|
|
|
|
|
2019-10-31 12:37:02 +05:30
|
|
|
This is the continuation of the original Debian/Ubuntu syslog daemon,
|
|
|
|
updated with full [RFC3164][] and [RFC5424][] support from NetBSD and
|
2019-12-07 15:00:14 +05:30
|
|
|
FreeBSD. The package includes the `libsyslog.{a,so}` library with a
|
|
|
|
`syslog.h` header replacement, the `syslogd` daemon, and a command
|
|
|
|
line tool called `logger`.
|
2019-10-31 12:37:02 +05:30
|
|
|
|
2019-11-03 16:53:05 +05:30
|
|
|
`libsyslog` and `syslog/syslog.h`, derived directly from NetBSD, expose
|
|
|
|
`syslogp()` and other new features available only in [RFC5424][]:
|
2019-10-31 12:37:02 +05:30
|
|
|
|
2019-12-09 21:31:02 +05:30
|
|
|
- https://man.troglobit.com/man3/syslogp.3.html
|
|
|
|
- https://man.troglobit.com/man8/syslogd.8.html
|
|
|
|
- https://man.troglobit.com/man5/syslog.conf.5.html
|
2019-10-31 12:37:02 +05:30
|
|
|
- https://netbsd.gw.com/cgi-bin/man-cgi?syslog+3+NetBSD-current
|
2018-08-03 02:20:06 +05:30
|
|
|
|
|
|
|
The `syslogd` daemon is an enhanced version of the standard Berkeley
|
2019-12-25 13:17:31 +05:30
|
|
|
utility program, updated with DNA from FreeBSD. It provides logging of
|
|
|
|
messages received from the kernel, programs and facilities on the local
|
|
|
|
host as well as messages from remote hosts. Although fully compatible
|
|
|
|
with standard C-library implementations of the `syslog()` API (GLIBC,
|
|
|
|
musl libc, uClibc), `libsyslog` must be used in your application to
|
|
|
|
unlock the new [RFC5424][] `syslogp()` API.
|
2018-08-03 02:20:06 +05:30
|
|
|
|
2019-10-31 12:37:02 +05:30
|
|
|
The included `logger` tool can be used from the command line, or script,
|
|
|
|
to send RFC5424 formatted messages using `libsyslog` to `syslogd` for
|
|
|
|
local or remote logging.
|
|
|
|
|
|
|
|
Main differences from the original sysklogd package are:
|
2018-08-03 02:20:06 +05:30
|
|
|
|
2019-12-25 13:17:31 +05:30
|
|
|
- The separate `klogd` daemon is no longer part of the sysklogd project,
|
|
|
|
syslogd now natively supports logging kernel messages as well
|
2019-11-15 13:28:16 +05:30
|
|
|
- *Major* command line changes to `syslogd`, for compatibilty with *BSD
|
2019-12-25 13:17:31 +05:30
|
|
|
- Supports `include /etc/syslog.d/*.conf` directive, see example .conf
|
2018-09-24 23:35:19 +05:30
|
|
|
- Built-in log-rotation support, with compression by default, useful for
|
2019-12-25 13:17:31 +05:30
|
|
|
embedded systems. No need for cron and/or a separate log rotate daemon
|
2019-11-15 13:28:16 +05:30
|
|
|
- Full [RFC3164][] and [RFC5424][] support from NetBSD and FreeBSD
|
|
|
|
- Support for sending RFC3164 style remote syslog messages, including
|
|
|
|
timestamp and hostname. Defaults to send w/o for compatibility
|
2019-10-31 12:37:02 +05:30
|
|
|
- Support for sending RFC5424 style remote syslog messages
|
2019-11-06 18:51:18 +05:30
|
|
|
- Support for sending messages to a custom port on a remote server
|
2019-11-15 13:28:16 +05:30
|
|
|
- Support for listening to a custom port
|
|
|
|
- Support for remote peer filtering, from FreeBSD
|
|
|
|
- Support for disabling DNS reverse lookups for each remote log message
|
2019-12-25 13:17:31 +05:30
|
|
|
- Support for FreeBSD Secure Mode, remote logging enabled by default(!)
|
2019-10-31 12:37:02 +05:30
|
|
|
- Includes a `logger` tool with RFC5424 capabilities (`msgid` etc.)
|
2019-11-15 13:28:16 +05:30
|
|
|
- Includes a syslog library and system header replacement for logging
|
2018-08-03 02:20:06 +05:30
|
|
|
- FreeBSD socket receive buffer size patch
|
|
|
|
- Avoid blocking `syslogd` if console is backed up
|
|
|
|
- Touch PID file on `SIGHUP`, for integration with [Finit][]
|
2018-09-24 23:35:19 +05:30
|
|
|
- GNU configure & build system to ease porting/cross-compiling
|
2018-09-25 13:46:17 +05:30
|
|
|
- Support for configuring remote syslog timeout
|
2018-08-03 02:20:06 +05:30
|
|
|
|
|
|
|
|
2019-11-04 10:29:54 +05:30
|
|
|
Using -lsyslog
|
|
|
|
--------------
|
|
|
|
|
|
|
|
libsyslog is by default installed as a library with a header file:
|
|
|
|
|
|
|
|
```C
|
|
|
|
#include <syslog/syslog.h>
|
|
|
|
```
|
|
|
|
|
|
|
|
The output from the `pkg-config` tool holds no surprises:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
$ pkg-config --libs --static --cflags libsyslog
|
|
|
|
-I/usr/local/include -L/usr/local/lib -lsyslog
|
|
|
|
```
|
|
|
|
|
|
|
|
The prefix path `/usr/local/` shown here is only the default. Use the
|
|
|
|
`configure` script to select a different prefix when installing libsyslog.
|
|
|
|
|
2019-12-25 13:17:31 +05:30
|
|
|
For GNU autotools based projects, instead of issuing the `pkg-config`
|
|
|
|
command manually, use the following in `configure.ac`:
|
2019-11-04 10:29:54 +05:30
|
|
|
|
|
|
|
```sh
|
|
|
|
# Check for required libraries
|
|
|
|
PKG_CHECK_MODULES([syslog], [libsyslog >= 2.0])
|
|
|
|
```
|
|
|
|
|
2019-12-25 13:17:31 +05:30
|
|
|
and for your "proggy" in `Makefile.am`:
|
2019-11-04 10:29:54 +05:30
|
|
|
|
|
|
|
```sh
|
|
|
|
proggy_CFLAGS = $(syslog_CFLAGS)
|
|
|
|
proggy_LDADD = $(syslog_LIBS)
|
|
|
|
```
|
|
|
|
|
2019-11-08 17:51:41 +05:30
|
|
|
The distribution comes with an [example][] program that utilizes the
|
|
|
|
NetBSD API and links against libsyslog.
|
2019-11-04 10:29:54 +05:30
|
|
|
|
|
|
|
|
2018-08-03 02:20:06 +05:30
|
|
|
Build & Install
|
|
|
|
---------------
|
|
|
|
|
|
|
|
The GNU Configure & Build system use `/usr/local` as the default install
|
|
|
|
prefix. In many cases this is useful, but this means the configuration
|
|
|
|
files and cache files will also use that same prefix. Most users have
|
|
|
|
come to expect those files in `/etc/` and `/var/run/` and configure has
|
|
|
|
a few useful options that are recommended to use:
|
|
|
|
|
2019-12-25 13:17:31 +05:30
|
|
|
```sh
|
|
|
|
./configure --prefix=/usr --sysconfdir=/etc --runstatedir=/run
|
|
|
|
make -j5
|
|
|
|
sudo make install-strip
|
|
|
|
```
|
2018-08-03 02:20:06 +05:30
|
|
|
|
2019-11-27 02:12:36 +05:30
|
|
|
You may want to remove the `--prefix=/usr` option. Most users prefer
|
|
|
|
non-distro binaries in `/usr/local` or `/opt`.
|
2018-08-03 02:20:06 +05:30
|
|
|
|
2021-07-26 17:34:45 +05:30
|
|
|
> **Note:** the `--runstatedir` option should point to a filesystem
|
|
|
|
> that is cleaned at reboot. syslogd relies on this for
|
|
|
|
> its `syslogd.cache` file, which keeps track of the last
|
|
|
|
> read kernel log message from `/dev/kmsg`.
|
|
|
|
|
2018-08-03 02:20:06 +05:30
|
|
|
|
|
|
|
Building from GIT
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
If you want to contribute, or just try out the latest but unreleased
|
|
|
|
features, then you need to know a few things about the [GNU build
|
|
|
|
system][buildsystem]:
|
|
|
|
|
|
|
|
- `configure.ac` and a per-directory `Makefile.am` are key files
|
|
|
|
- `configure` and `Makefile.in` are generated from `autogen.sh`,
|
|
|
|
they are not stored in GIT but automatically generated for the
|
|
|
|
release tarballs
|
|
|
|
- `Makefile` is generated by `configure` script
|
|
|
|
|
|
|
|
To build from GIT you first need to clone the repository and run the
|
|
|
|
`autogen.sh` script. This requires `automake` and `autoconf` to be
|
|
|
|
installed on your system.
|
|
|
|
|
2019-12-25 13:17:31 +05:30
|
|
|
```sh
|
|
|
|
git clone https://github.com/troglobit/sysklogd.git
|
|
|
|
cd sysklogd/
|
|
|
|
./autogen.sh
|
|
|
|
./configure && make
|
|
|
|
```
|
2018-08-03 02:20:06 +05:30
|
|
|
|
|
|
|
GIT sources are a moving target and are not recommended for production
|
|
|
|
systems, unless you know what you are doing!
|
|
|
|
|
2019-11-27 02:12:36 +05:30
|
|
|
**Note:** some systems may have an older, or a vanilla, version of the
|
|
|
|
GNU autoconf package that does not support `--runstatedir` (above).
|
|
|
|
Users on such systems are recommended to use `--localstatedir`, the
|
|
|
|
`$runstatedir` used by sysklogd is derived from that if missing.
|
|
|
|
|
2018-08-03 02:20:06 +05:30
|
|
|
|
|
|
|
Origin & References
|
|
|
|
-------------------
|
|
|
|
|
2019-11-08 17:51:41 +05:30
|
|
|
This is the continuation of the original sysklogd by Dr. G.W. Wettstein
|
2019-12-07 15:39:09 +05:30
|
|
|
and [Martin Schulze][]. Currently maintained, and almost completely
|
|
|
|
rewritten with the latest DNA strands from NetBSD and FreeBSD, by
|
2020-09-01 00:58:25 +05:30
|
|
|
[Joachim Wiberg][]. Please file bug reports, or send pull requests for
|
2019-12-07 15:39:09 +05:30
|
|
|
bug fixes and proposed extensions at [GitHub][].
|
2019-11-13 14:39:41 +05:30
|
|
|
|
2019-12-07 15:39:09 +05:30
|
|
|
The project was previously licensed under the GNU GPL, since the removal
|
|
|
|
of `klogd` the project is now [3-clause BSD][BSD License] licensed.
|
2018-08-03 02:20:06 +05:30
|
|
|
|
2019-10-31 12:37:02 +05:30
|
|
|
[RFC3164]: https://tools.ietf.org/html/rfc3164
|
|
|
|
[RFC5424]: https://tools.ietf.org/html/rfc5424
|
2018-08-03 02:20:06 +05:30
|
|
|
[Martin Schulze]: http://www.infodrom.org/projects/sysklogd/
|
2020-09-01 00:58:25 +05:30
|
|
|
[Joachim Wiberg]: https://troglobit.com
|
2018-08-03 02:20:06 +05:30
|
|
|
[Finit]: https://github.com/troglobit/finit
|
|
|
|
[GitHub]: https://github.com/troglobit/sysklogd
|
2019-11-08 17:51:41 +05:30
|
|
|
[example]: https://github.com/troglobit/sysklogd/tree/master/example
|
2018-08-03 02:20:06 +05:30
|
|
|
[buildsystem]: https://airs.com/ian/configure/
|
2020-09-01 00:58:25 +05:30
|
|
|
[BSD License]: https://en.wikipedia.org/wiki/BSD_licenses
|
2019-11-13 14:39:41 +05:30
|
|
|
[BSD Badge]: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg
|
2018-08-03 02:20:06 +05:30
|
|
|
[Travis]: https://travis-ci.org/troglobit/sysklogd
|
|
|
|
[Travis Status]: https://travis-ci.org/troglobit/sysklogd.png?branch=master
|
2019-11-03 22:29:51 +05:30
|
|
|
[Coverity Scan]: https://scan.coverity.com/projects/19540
|
|
|
|
[Coverity Status]: https://scan.coverity.com/projects/19540/badge.svg
|