CAP_JOURNALTHREADS

Configure Syslogd2 to use the Systemd Journal for Input


Home Page

Configure Syslogd2

Sample Files

Deployment

New Concepts

The Config File

Compile & Install

Misc Topics

Capabilities

CAP_???

About JournalThreads
The --journal command
The --journalfield command

Demonstrations

Reference

Glossary of Terms

External Links

Syslogd2 Project Site
DBD2 Home Page
DBD2 Project Site

Other References

RFC 3164 (The BSD Syslog Protocol)
RFC 3339 (Internet Time Format)
RFC 5424 (Syslog Version 1)

Focus on Network

Syslogd2 Input Options
Syslogd2 Output Options
Queueing and Data Loss

About the Syslogd2 JournalThreads Input module

[Top of page]

The Syslogd2 implementation of systemd journal input is a dedicated, single-instance optional input-type threadpool. Before it can be used (or configured), it must be declared using the CAP_JOURNALTHREADS option at compile-time. At run-time, it must be enabled usiung --enable journalthreads.

There is never more than one JournalThreads threadpool for any given Syslogd2 binary. This is because there is never more than a single instance of a systemd journal on any given host and therefore no need for more than one threadpool to monitor this journal.

Configuration of the JournalThreads threadpool consists of a single --journal command followed by zero or more --journalfield commands.

The JournalThreads implementation in Syslogd2 achieves multiple objectives.

  1. It provides basic syslog-formatted data allowing selection of either syslog-originated fields or journal-originated fields in many cases (syslog-fields are preferred if avaialable).
  2. It illustrages (and demonstrates) the use of the Syslogd2-specific sd-string field for parameter-passing. The syslog format produced by this module can be fed directly into the DBD2 project where each field can be parsed into named database fields. As a side note, the implementation of this feature stressed the overall Syslogd2 system sufficiently that it highlighted some additional (structural) changes that needed to be made due to unexpected issues surrounding buffer lengths (CAP_VARBUFFERS) and open-file limits
  3. It provides access to additional "syslog-formatted" input from Linux platforms for network-management purposes.
  4. Each input line (and each additional data-field) from the systemd journal is fully supported by Syslogd2 filters for both routing, data-reduction and data modification. Thus the non-syslog inputs from the journal can serve as additional sources of network-management alerts being monitored by Syslogd2.

CAUTION: The systemd journal API used by Syslogd2 opens a large number of files per instance. I don't know the exact number, but suspect it varies from host-to-host and numbers in the hundreds if not muliple hundreds of files. This suspicion was borne out when I opened 8 concurrent thread instances of this API and promptly exceeded the process-limit of 1024 files-per-process. If you use the CAP_JOURNALTHREADS interface, I STRONGLY recommend that you increase this process-limit. The performance and stability of Syslogd2 will otherwise be compromised due to its inability to open additional files (or sockets, pipes, or user-terminals) for either input or output. I HAVE successfully used the joural interface with low levels of concurrancy (4 instances or less) of CAP_JOURNALTHREADS without exceeding this limit, but cannot recommend doing so as a routine matter.

root# ulimit -a
root# ulimit -n 2048
root# ulimit -a

The --Journal command

[Top of page]

The '--journal' command is used to configure systemd-journal input to Syslogd2. The journal input-mechanism uses various journal fields to 'create' a syslog-formatted string that is then submitted to Syslogd2 processing steps as if it had been read from an external source. The process of creating this string can be affected by various --journal-specific options enumerated below.

If CAP_JOURNALTHREADS is defined and enabled, Syslogd2 will automatically create a default 'journalthreads threadpool as if a '--journal' command had been entered using an option string of "append". This will result in 'standard' syslog events being produced from all active journal sources (and likely a large amount of overlap if combined with the events received from the systemd-forwarding-socket at /run/systemd/journal/syslog). The overlap would be caused by both Syslogd2 input methods forwarding the same information from the same originating source (the journal).

Syslogd2's default --journal input-specification can be over-ridden by specifying a --journal command anywhere within the configuration file in accordance with (IAW) Syslogd2's first-come-first-serve parsing policy.

There is no primary parameter for the --journal command since an Application Programming Interface (API) is used to read data. There is only a list of options. As is the case throughout Syslogd2, all keywords are non-case-sensitive.

'--journal' is considered to be an input-command. As such, it accepts generic Syslogd2 input options in addition to the specific '--journal' options enumerated below. These generic input options include (but are not limited to) threadpool selection and configuraiton options, 'facility', 'priority', 'ignore', 'filter', 'network', and 'hostname'.


Example usage (Note: Only one '--journal' line is accepted per instance of Syslogd2 2nd and subsequent entries are errors and will be ignored. The entries below are intended to show different possibilities for using the command and may NOT be used at the same time.

~ --journal src=!syslog;!kernel, timestamp=s, allfields, tagname=s, tagpid=s, nosdlength, append, id=1, facility=extra23, filter=journal.input.filter

~ --journal src = all, timestamp = j, allfields = no, notagfield, append, id = 0, r = 4, ignore = hostname, network = local;other, dns = no


The --JournalField command

[Top of page]

The --JournalField command is used to specify field-level exceptions to the general settings provided by the --journal command (whether the default instance of the command or one specified by the local administrator. Multiple instances of --journalFields command are supported.

The --journalfield command takes a systemd journal fieldname as a primary argument. Though all fieldnames used by the journal are in uppercase, Syslogd2 allows these naems to be upper- or lower-case and will ignore leading underscores ('_') when matching fieldnames. Since there is no definitive list of journal fieldnames, the best way to find out what names are available is to run Syslogd2 with allfields = yes for a while and to then review the available data to see which fields can be ignored completely and which fields you may want to keep.

--journalfields is NOT considered an 'input-command', so does NOT support fields other than those listed in this section.

If AllFields is enabled in the --journal command, --journalfields can use its disable option to suppress individual fields.

If AllFields is disabled in the --journal command, --journalfields will define the fields that are to be displayed. These fields will be sequenced into the overall SD-String field in the order in which they are declared by successive --journalfield commands.

The list of options supported by --journalfields is currently quite short:


--JournalFields usage examples:

~ --journalfield = transport = src
~ --journalfield = machine_id, disable
~ --journalfield invocation_id, disable = yes
~ --journalfield message = msg, maxlength = 40


[Top of page]