Written by Rainer Gerhards (2008-03-28)
Rsyslog aims to be a drop-in replacement for sysklogd. However, version 3 has some considerable enhancements, which lead to some backward compatibility issues both in regard to sysklogd and rsyslog v1 and v2. Most of these issues are avoided by default by not specifying the -c option on the rsyslog command line. That will enable backwards-compatibility mode. However, please note that things may be suboptimal in backward compatibility mode, so the advise is to work through this document, update your rsyslog.conf, remove the no longer supported startup options and then add -c4 as the first option to the rsyslog command line. That will enable native mode.
Please note that rsyslogd helps you during that process by logging appropriate messages about compatibility mode and backwards-compatibility statemtents automatically generated. You may want your syslogd log for those. They immediately follow rsyslogd's startup message.
With v2 and below, inputs were automatically started together with rsyslog. In v3, inputs are optional! They come in the form of plug-in modules. At least one input module must be loaded to make rsyslog do any useful work. The config file directives doc briefly lists which config statements are available by which modules.
It is suggested that input modules be loaded in the top part of the config file. Here is an example, also highlighting the most important modules:
$ModLoad immark # provides --MARK--
message capability
$ModLoad imudp # provides UDP syslog reception
$ModLoad imtcp # provides TCP syslog reception
$ModLoad imgssapi # provides GSSAPI syslog
reception
$ModLoad imuxsock # provides support for local
system logging (e.g.
via logger command)
$ModLoad imklog # provides kernel logging support (previously done
by rklogd)
A number of command line options have been removed. New config file directives have been added for them. The -h and -e option have been removed even in compatibility mode. They are ignored but an informative message is logged. Please note that -h was never supported in v2, but was silently ignored. It disappeared some time ago in the final v1 builds. It can be replaced by applying proper filtering inside syslog.conf.
The -c option is new and tell rsyslogd about the desired backward compatibility mode. It must always be the first option on the command line, as it influences processing of the other options. To use the rsyslog v3 native interface, specify -c4. To use compatibility mode , either do not use -c at all or use -c<vers> where vers is the rsyslog version that it shall be compatible to. Use -c0 to be command-line compatible to sysklogd.
The -m command line option is emulated in compatibiltiy mode. To replace it, use the following config directives (compatibility mode auto-generates them):
$ModLoad immark
$MarkMessageInterval 1800 # 30 minutes
Is no longer available in native mode. However, it is understood in compatibility mode (if no -c option is given). Use the $UDPSeverRun <port> config file directives. You can now also set the local address the server should listen to via $UDPServerAddress <ip> config directive.
The following example configures an UDP syslog server at the local address 192.0.2.1 on port 514:
$ModLoad imudp.so
$UDPSeverAddress 192.0.2.1 # this MUST be before the $UDPServerRun
directive!
$UDPServerRun 514
"$UDPServerAddress *" means listen on all local interfaces. This is the default if no directive is specified.
Please note that now multiple listeners are supported. For example, you can do the following:
$ModLoad imudp.so
$UDPSeverAddress 192.0.2.1 # this MUST be before the $UDPServerRun
directive!
$UDPServerRun 514
$UDPSeverAddress * # all local interfaces
$UDPServerRun 1514
These config file settings run two listeners: one at 192.0.2.1:514 and one on port 1514, which listens on all local interfaces.
Please note that with pre-v3 rsyslogd, a service database lookup was made when a UDP server was started and no port was configured. Only if that failed, the IANA default of 514 was used. For TCP servers, this lookup was never done and 514 always used if no specific port was configured. For consitency, both TCP and UDP now use port 514 as default. If a lookup is desired, you need to specify it in the "Run" directive, e.g. "$UDPServerRun syslog".
klogd has (finally) been replaced by a loadable input module. To enable klogd functionality, do
$ModLoad imklog.so
Note that this can not be handled by the compatibility layer, as klogd was a separate binary.A limited set of klogd command line settings is now supported via rsyslog.conf. That set of configuration directives is to be expanded.
Rsyslog supports high precision RFC 3339 timestamps and puts these into local log files by default. This is a departure from previous syslogd behaviour. We decided to sacrify some backward-compatibility in an effort to provide a better logging solution. Rsyslog has been supporting the high-precision timestamps for over three years as of this writing, but nobody used them because they were not default (one may also assume that most people didn't even know about them). Now, we are writing the great high-precision time stamps, which greatly aid in getting the right sequence of logging events. If you do not like that, you can easily turn them off by placing
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
right at the start of your rsyslog.conf. This will use the previous format. Please note that the name is case-sensitive and must be specificed exactly as shown above. Please also note that you can of course use any other format of your liking. To do so, simply specify the template to use or set a new default template via the $ActionFileDefaultTemplate directive. Keep in mind, though, that templates must be defined before they are used.
Keep in mind that when receiving messages from remote hosts, the timestamp is just as precise as the remote host provided it. In most cases, this means you will only a receive a standard timestamp with second precision.
Please note that the default forwarding format may also change in the future.
Either "FixedArray" or "LinkedList" is recommended. "Direct" is available, but should not be used except for a very good reason ("Direct" disables queueing and will potentially lead to message loss on the input side).