Input Options for Syslogd2
(Configuring Syslogd2 Inputs)
The general format of a Syslogd2 input command is:
--<keyword> = <primary-parameter>,<option-list>
The primary parameter is the 'source' of the data (a filename, socket specification, named-pipe filepath, etc).
There are two threadpools that use a 'null' (empty) primary parameter (the kernel and journal input threadpools).
In the case of the kernel threadpool, either input comes from a file specified in the kernel-headers or from a system-call, making a primary parameter meaningless.
In the case of the journal threadpool, input comes from the systemd-journal API which (again) makes the concept of a primary parameter meaningless.
The option-list is a comma-separated list of options, each of which is a keyword (and therefore parsed as non-case-sensitive).
The options in this list will be a mixture of boolean values, integers, strings, keywords, lists and strings depending on their purpose.
The order in which options are listed does not matter. If an option is duplicated, the first entry (left-to-right) will be used.
This is a good time to remember that Syslogd2 provides access to a number of 'extra' facilities (32 by default: 'extra0' through 'extra31') that
can be used as clean 'scratchpads' to keep incoming data-streams clear of the more traditional facilities that might otherwise 'corrupt' the incoming data.
The number of these 'extra' facilities defaults to 32, but can range from 0 [zero] through 1000 [one thousand] when set at compile-time. There are no run-time confiuration options
for these 'extra' facilities, but they can be accessed and used at run-time as you will see throughout this webpage.
All boolean values in Syslogd2 primary configuration files (excluding secondary files such as filter-files, cache-file, etc) take an optional parameter.
This is because of the difficulty around specifiying that DNS should be disabled for a connection after it has been globally enabled.
(There is simply no way to provide a syntax that says to positively return a boolean value to its default state after it has been toggled, then inherited.)
The parameter to enable any boolean value is one of '1', 'y', or 'yes'. Omitting the parameter will also set the booelan value.
To disable the booelan value, use '0', 'n' or 'no'.
... boolean, boolean = y, boolean = 1, boolean = yes ## these settings enable the value 'boolean'
... boolean = n, boolean = 0, boolean = no ## these settings disable the value 'boolean'
Note that the options 'y' and 'n' allow for better readability and positive settings (either enable or disable) when the value for boolean may be inherited as either setting.
The rules for using --enable and --disable (which are themselves boolean in nature) combine with the positive-settings provided by the boolean parameters in predictable ways. Syslogd2 considers that --enable is 'positive' and --disable is 'negative'. Likewise, 'y' or simply setting the value is 'positive' while 'n' is 'negative. Thus:
~ --enable boolean, boolean = y, boolean = 1 ## '=' omitted. these values are enabled.
~ --disable boolean, boolean = y, boolean = 1 ## '=' omitted. these values are disabled.
~ --enable boolean = n, boolean = 0 ## '=' omitted. these values are disabled.
~ --disable boolean = n, boolean = 0 ## '=' omitted. these values are enabled.
<Not mentioning the boolean variable at all> ## boolean retains its default (inherited) state (usually disabled).
Essentially, two 'wrongs' DO make a 'right' (double-negatives cancel each other out).
The option list associated with each input specification in Syslogd2 is a comma-separated list of options from multiple categories that may be freely mixed in any desired sequence. Some of these option categories are unique to specific input methods and are covered in the section that covers that input method. The rest of the options are generic in the sense that they can be used with any input method. These options are covered (by category) below.
Identity options depend entirely upon the connection used to read a particular input source. These options are less about operational settings than they are about distinguishing one connection from another (Examples: port (an inteer) and selection of UDP or TCP (booleans)). The scope of an identity option is limited to a single connection. These options will be covered under individual sections devoted to each threadpool type.
Threadpool-type-specific options depend entirely upon the threadpool-type that is supporting a given input specification.
The scope of a threadpool-type-specific option is a single threadpool.
Threadpool-type-specific options may be set globally using the --defaults command or per-threadpool using the --ThreadMaps command.
Threadpool-type-specific settings may also (often) be set by individual connection specifications (Examples: pollinterval (an integer) and poll (a boolean)).
If this method of setting threadpool parameters is chosen, one of two scenarios will be executed:
For boolean values, only the first connection seen by the parser (lowest line number) for each threadpool will actually set the option (or leave it at default values).
Subsequent connections that use the same threadpool will ignore the setting.
For integer values, a one-way 'ratchet' is implemented.
Buffer-line and thread counts may only be increased. Timeout values (including poll-intervals) may only decrease.
The reasoning behind this is that a particular source may have minimum resource needs, so it will 'bump' the parameters of whichever threadpool that connection is assigned to in
order to increase resources to 'minimum acceptable' values.
Threadpool-type-specific options are covered under the individual sections devoted to each threadpool type.
Input sources in Syslogd2 may be grouped (subject to compatbilities below) into threadpools with each different group (of compatible connections) 'serviced' by
a unique threadpool resource set of (1) code-algorithm and (2) multiple, shared execution-threads.
Given the variety of inputs supported, there may be up to one (1) kernel and one (1) journal threadpool, but multiple of each of socket/pipe and text-file
threadpools -- all operating simultaneouly with different thread-counts, (and if enabled) different worker-type threadpools each with different buffer-sizes, worker-threads
and queueing characteristics.
Individual connections specify the threadpool they will become a component (client) of using the 'threadpoolid = n' or 'id = n' option.
The default value of 'n' is always 0, regardless of threadpool type. Unless otherwise stated, this puts all (compatible) inputs into a minimum number of threadpools
where they share threads and other resources.
The allowed values for 'ThreadpoolId' ('id') are the complete range of non-negative integers. Each of the following threadpool-types has its own separate series of
'id' numbers: socket/pipe/tailfile, kernel, journal, user, worker, output and housekeeping.
Of these, kernel, journal, housekeeping and user threadpool types are all single-instance, one-off threadpools with their threadpool-id ignored (set to zero).
The socket/pipe/tailfile, worker and output threadpool types may each have a many threadpool instances as desired (and supported by the underlying hardware).
The restrictions mentioned above concerning the 'grouping' of connection-types into threadpools are:
Syslogd2 performs some sleight-of-hand during startup when it encounters a text-file (tailfile) 'connection' specifying 'threadpool-id 0 [zero]'. It silently
changes the threadpool-id number to an (otherwise illegal) value of -2 in order to de-conflict the setting with sockest/named-pipes that also default to threadpool-id 0.
The full set of (optional) threadpool-selection/configuration options available to all inputs (not counting threadpool-specific options) at the connection level is listed below.
All threadpoolid values default to zero as do all queue values. Unless CAP_WORKERTHREADS was declared at compile-time, the 'workers', 'lines' and 'queue' options
will be non-valid.
--<keyword> = ... , id=1, readers=3, workers=4, lines = 50, queue=1, ... ## with CAP_WORKERTHREADS defined
--<keyword> = ... , id=0, readers=3, ... ## without CAP_WORKERTHREADS defined
These options are inter-related and important enough to deserve their own grouping. These are 'base' options (meaning there are no compile-time requirements to use them).
These options work by over-riding the inherited values set at the global level (or compiled into the code). Any input string
received that does not contain an imbedded 'facility/priority' (facpri) field, will use these faciltiy/priority values if set. If not set, the incoming message will be assigned
the global value for kernelfacility (or kern.notice if not set) for messages from the kernel or the global value userfacility (or user.notice if not set).
The full list of options in this grouping are:
~ --<keyword> = ... , facility = extra0, priority = notice, hostname = callcenter.$h.$d, \
ignore = facility; priority; hostname, noheader, ...
The last 'grouping' of input-options is the 'other' group. This is comprised of miscellaneous options that don't fit any of the other categories.
Socket input in Syslogd2 is the only input-type in the 'base' feature-set' (meaning it requires no compile-time options).
By default, Syslogd2 will open one Linux datagram socket at /dev/log (or the location of system header files if ported to a non-linux machine). The user may over-ride
the location of this default socket via global variables (--defaults logsocket=) at run-time. The user may also disable the creation of this default input socket
(--disable syslog) at runtime. The default definition of this socket may also be over-ridden simply by re-declaring it (the default declaration carries a line-number
higher than the number of lines in the file, so it will always lose a first-come-first-serve conflict).
If the IP service is enabled (--enable inet or -i or -r), and at least one address-family is available to use, Syslogd2 will also open
UDP/IP port 514 (defined syslog) on the address '*' (all interfaces). If -f (--enable forwarding) is also present, Syslogd2 will allow traffic received
from an IP interface to be forwarded to a remote host over IP as well.
This action mirrors that of traditional syslog processors (even to using the -i and -f or -r command-line parameter to enable IP services).
If the IP service is enabled, the default IP port can still be disabled using --disable defaultip.
Like the default Linux socket above, the default IP input carries a line-number higher than the number of lines in the file, so it too, will always lose a
first-come-first-serve conflict.
The keywords used to specify socket input(s) are --socket= and --input=. These keywords are aliases of each other.
The primary parameter to these keywords is either an absolute pathname (to define a Linux socket) or an IP address or IP hostname (to define an IP socket).
The primary parameter format (does it start with '/' ?) determines Linux vs IP.
Identity options are used to specify the protocol (and for IP the port to connect to). (Reminder: all keywords are non-case-sensitive)
There are no threadpool-specific keywords used with socket input threadpools.
Connection-specific keywords that affect Linux sockets (and also apply to Name-Pipes) define the file-system parameters of the device that is created when the listening
connections are opened. These parameters are valid on Linux sockets and Named pipes only:
Global keywords that affect socket operations include:
Examples of socket input definitions for:
A hypothetical network input (via IP) (Assumes that CAP_WORKERTHREADS is enabled).
This input definition also forces all incoming switch/router traffic to the unused facility 'extra2' to avoid conflict with standard syslog facilities.
It also uses the high-speed algorithm by creating (specifying) threadpool number 1 (one) that is comprised of only one datagram socket.
~ --enable inet, forwarding
~ --input 192.168.2.40, noforceprintable, noheader, id=1, readers=5, workers=15, lines=100, \
queue=1, filter=filters/switchrouter.input.filter, facility=extra2, ignore=facility
A Syslogd2 command input (via streaming Linux socket)
~ --input /dev/logstream, stream, command, mode=600 ## only root should now be able to use this socket.
Adding a filter to the default Linux socket definition on a systemd-based Linux host.
~ --systemd ## Tell Syslogd2 that systemd is in use and to move the 'default' Linux input port accordingly
~ --disable syslog ## disable the default syslog port. (makes the above line redundent)
~ --input /run/systemd/journal/syslog, nohost, filter=filters/defLinux.input.filter ## new definition (with filter)
The keyword to confiure Syslogd2 to obtain input from the Linux systemd journal subsystem is '--journal'. There should only ever be one instance of the
'--journal' keyword in any given configuration (there is only one threadpool to confiure and only one journal to read from).
The keyword '--journalfield' is used to configure individual journal fields.
The systemd journal is best thought of as a database that Syslogd2 can sequentially traverse (query) using a systemd-provided Application Programming Interface (API).
With each step a series of data-fields is made available to Syslogd2 who then combines the available data into a raw syslog string that is passed to the processing phase
as if it had been read from a file, socket, kernel or pipe.
It must be stressed that the systemd journal is NOT syslog (nor is it even based on syslog). A fairly detailed discussion of configuring Syslogd2 to 'read' from a
systemd journal can be found here. There is little sense in copying the detailed information from the link to here,
so I'll just briefly review the '--journal' and '--journalfield' command options for the sake of completeness of this page.
The --journal keyword requires that the CAP_JOURNALTHREADS compiler-symbol was included at compile-time.
There should never be more than one instance of the '--journal' keyword in any configuration.
There is one (1) global configuration setting that affects sysemd journal input operation:
There are no threadpool-specific configuration parameters for the journal threadpool.
There are several connection-specific configuration parameters for the journal threadpool:
The systemd journal tracks approximately 35 different values for most events. Of these around 6-10 are of little to no practical use to netowrk managers and another 4-5 are already provided as syslog msg components (though perhaps not always the preferred fields). This leaves around 25 fields that are worth 'exploring' for insertion into syslog events.
The --journalfield command is secondary to (and supports) the --journal command. Multiple instances of the --journalfield command may be used.
Each instance of the --journalfield command configures one journal field. The order in which the --journalfield are encountered in the configuration file dictates
the order in whichh the fields are defined in the sd-string portion of journal-originated messages. If the --journal's AllFields value is not set, only the fields
specified by the --journalfield command will be included in the message. if AllFields is set, then (after all --journalfield entries are resolved), all
remaining fields will be added to the sd-string in the order they were read from the journal interface.
The format of the --journalfield command is:
~ --journalfield = <journal-field-name> [ = <user-preferred-name>], <option-list>
The options to the --journalfield command are:
The ability to rename the default journal-defined fields is intended to facilitate database insertion and manipulation operations for downstream applications (such as DBD2.
Development of the Journal input threadpool subsystem highlighted some additional topics that deserve mention here so that precautionary action can be taken.
root# ulimit -n
root# ulimit -n 2048
root# ulimit -n
The keyword to configure kernel input in Syslogd2 is '--kernel'.
If the CAP_KERNELTHREADS option is defined at compile-time, a kernel threadpool will automatically be defined and used.
A minimal kernel input definition is automatically provided (unless either kernelthreads or kernellogging is disabled) using a line-number
higher than the last line in the configuration file (as in the default syslog and IP socket port definitions).
Only one instance of the --kernel keyword is allowed.
There are no identity options for the '--kernel' keyword.
All incoming data processed by this threadpool is automatically designated as coming from the kernel.
This means it will use default facility/priority values from kernelfaciltiy instead of from userfacility
There are two threadpool-specific options with this keyword:
Global parameters affecting Kernel logging:
Example: (redundantly) enables kernel log input and uses the kernel threadpool, specifies to use system calls and defines an input-filter and at least 4 read-threads.
~ --enable kernellogging = yes, kernelthreads = yes ~ --kernel filter = filters/kernel.input.filter, poll = no, r=4
The keyword used to configure named-pipe input in Syslogd2 is --pipe.
This input method requires that the CAP_PIPESIN symbol was declared at compile-time for this binary image.
Named-pipe input does not have to be enabled. There is no default value or automatic configuration element.
Multiple instances of the --pipe option are allowed.
Named pipes may mix with sockets in the same threadpool.
There are no identity options for named-pipes. (Their unique pathnames identify them).
There are no threadpool-specific options for named-pipes
The only global parameter that affects named-pipe input is the global 'PollInterval' setting that is shared with the kernel threadpool and the tailfile threadpools.
There is one connection-specific option for named-pipes:
An example of a named-pipe input command. This command forces all incoming traffic to 'extra4' (while keeping pre-existing priority values) in order to 'dodge' other traffic.
~ --pipe /dev/pipe2syslog, polltime=60, id=3, filter=filters/pipe2syslog.input.filter, facility=extra4, ignore=facility
The keyword used to configure text-file input is --tailfile (or --tail or --inputtailfile).
There are no identity options for tailfiles entries (the absolute pathname is sufficient identification).
The only global parameter that affects --tailfile input is the global 'PollInterval' setting that is shared with the kernel threadpool and the pipe threadpools.
There is one (1) threadpool-specific option for --tailfile threadpools:
There are two (2) connection-specific options for tailfiles:
An example of a named-pipe input command. This command forces all incoming traffic to 'extra4' (while keeping pre-existing priority values) in order to 'dodge' other traffic.
# Because of 'soft-comments', the two lines below are actually valid and active configuration entries from Syslogd2's perspective.
# (Any line that does not start with either a tilde (~) or facility-name (after at most one hashtag ('#') is a soft-comment and ignored -- including this line.)
#
# 'Soft-comment' status is preesrved across concatenated lines as well...
#
#~ --tailfile /var/log/mysql/error.log, id=0, nohost, append, facility=extra6 , ignore facility, \
# phostname=mariadb.$h.$d, \
# filter=filters/mariadb.error.input.filter
#
#~ --tailfile /var/log/nginx/error.log, nohost, append, facility = extra30, priority = debug