TCP (im_tcp)
This module accepts TCP connections on the configured address and port. It can handle multiple simultaneous connections. The TCP transfer protocol provides more reliable log transmission than UDP. If security is a concern, consider using the im_ssl module instead.
| To examine the supported platforms, see the list of installation packages. |
Configuration
The im_tcp module accepts the following directives in addition to the common module directives.
Optional directives
Set this directive to the IP address or DNS hostname on which the module accepts connections.
The default is Append the port number to the address using a colon separator ( You can specify this directive multiple times to accept connections on multiple addresses or ports within a single module instance. Set IPv4 and IPv6 addresses as separate entries. If you use a DNS name, keep the number of addresses or CNAMEs below 16 to avoid errors caused by DNS response size limits. |
|
Set this directive to restrict incoming connections to specific IP addresses or networks.
You can specify this directive multiple times to allow multiple IPs or networks.
If The following IP address formats may be used:
|
|
Set this directive to deny incoming connections from specific IP addresses or networks.
You can specify this directive multiple times to deny multiple IPs or networks.
If The following IP address formats may be used:
|
|
Set this directive to limit the number of concurrent active connections for a listening TCP socket.
The default is
|
|
Set this directive to close TCP connections that have been idle for longer than the specified number of seconds. The minimum value is 15 seconds. If this directive is not set, the module keeps idle TCP connections open indefinitely. |
|
Set this directive to The default is This directive is only supported on Windows. |
|
Set this directive to The default is |
|
Set this directive to The default is This directive is not supported on Windows. |
| TCP connections are kept alive by keep-alive packets. This feature is enabled by default and cannot be disabled. |
Examples
With this configuration, NXLog Agent listens for TCP connections on port 1514 and writes the received log messages to a file.
<Input tcp>
Module im_tcp
ListenAddr 0.0.0.0:1514
</Input>
<Output file>
Module om_file
File "tmp/output"
</Output>
<Route tcp_to_file>
Path tcp => file
</Route>
The configuration below provides two im_tcp module instances to reuse port 1514 via the ReusePort directive.
Received messages are written to the /tmp/output file.
<Input tcp_one>
Module im_tcp
ListenAddr 192.168.31.11:1514
ReusePort TRUE
</Input>
<Input tcp_two>
Module im_tcp
ListenAddr 192.168.31.11:1514
ReusePort TRUE
</Input>