UDP (om_udp)
This module sends log messages as UDP datagrams to the address and port specified. UDP is the transport protocol of the legacy BSD Syslog standard as described in RFC 3164, so this module can be particularly useful to send messages to devices or Syslog daemons which do not support other transports.
Configuration
The om_udp module accepts the following directives in addition to the common module directives. The Host directive is required.
Required directives
The following directives are required for the module to start.
The module connects to the IP address or hostname defined in this directive. If additional hosts are specified on new lines, the module works in a failover configuration. If a destination becomes unavailable, the module automatically fails over to the next one. If the last destination becomes unavailable, the module fails over to the first destination.
The port number can be defined by appending it at the end of the hostname or IP address using a colon as a separator (
|
|||||
The module connects to the port number on the destination host defined in this directive. This configuration is only used for any destination in the Host directive which does not have a port specified. If no port is configured for a destination in either directive, the default port is used, which is port 514.
|
Optional directives
This optional directive specifies the local port number of the connection. If this is not specified, a random high port number will be used, which is not always ideal in firewalled network environments.
|
|||
See the OutputType directive in the list of common module directives. If this directive is not specified, the default is Dgram. |
|||
This optional directive sets the reconnect interval in seconds. If it is set, the module attempts to reconnect in every defined second. If it is not set, the reconnect interval will start at 1 second and doubles with every attempt. If the duration of the successful connection is greater than the current reconnect interval, then the reconnect interval will be reset to 1 sec.
|
|||
This optional directive sets the socket buffer size (SO_SNDBUF) to the value specified. If this is not set, the operating system default is used. |
Procedures
The following procedures are exported by om_udp.
reconnect();
-
Force a reconnection. This can be used from a Schedule block to periodically reconnect to the server.
The reconnect() procedure must be used with caution. If configured, it can attempt to reconnect after every event sent, potentially overloading the destination system.
Examples
This configuration reads log messages from socket and forwards them via UDP.
<Input uds>
Module im_uds
UDS /dev/log
</Input>
<Output udp>
Module om_udp
Host 192.168.1.1:1514
</Output>
<Route uds_to_udp>
Path uds => udp
</Route>
This configuration sends logs via UDP in a failover configuration (multiple Hosts defined).
<Output udp>
Module om_udp
Host 192.168.1.2:1514
Host 192.168.1.3:1514
Host example.com:1234
</Output>