111.19. TCP (om_tcp)
This module initiates a TCP connection to a remote host and transfers log messages. Or, in Listen mode, this module accepts client connections and multiplexes data to all connected clients. The TCP transfer protocol provides more reliable log transmission than UDP. If security is a concern, consider using the om_ssl module instead.
111.19.1. Configuration
The om_tcp module accepts the following directives in addition to the common module directives. The Host directive is required.
- Host
-
The module will connect to this IP address or DNS hostname. Or, if Listen is set to TRUE, the module will listen for connections on this address.
- Port
-
The module will connect to this port number on the remote host. Or, if Listen is set to TRUE, the module will listen for connections on this port. The default is port 514.
- LocalPort
-
This optional directive specifies the local port number of the connection. This directive only applies if Listen is set to FALSE. If this is not specified a random high port number will be used, which is not always ideal in firewalled network environments.
- OutputType
-
See the OutputType directive in the list of common module directives. The default is LineBased_LF.
- QueueInListenMode
-
If set to TRUE, this boolean directive specifies that events should be queued if no client is connected. If this module’s buffer becomes full, the preceding module in the route will be paused or events will be dropped, depending on whether FlowControl is enabled. This directive only applies if Listen is set to TRUE. The default is FALSE: om_tcp will discard events if no client is connected.
- Reconnect
-
This directive has been deprecated as of version 2.4. The module will try to reconnect automatically at increasing intervals on all errors.
111.19.2. Procedures
The following procedures are exported by om_tcp.
reconnect();
-
Force a reconnection. This can be used from a Schedule block to periodically reconnect to the server.