Route settings

A route name may contain letters, digits, periods (.), and underscores (_). The first character of a route name must be a letter, a digit, or an underscore. NXLog Agent uses the following regular expression to validate the name:

Route blocks support the following directives.

Required directives

Path

The data flow is defined by the Path directive. First, the instance names of input modules are specified. If the route contains more than one input source, then these must be separated by a comma. The list of input modules is followed by an arrow (=>). Either processor modules or output modules follow. Processor modules must be separated by an arrow, not a comma, because they operate in series, unlike input and output modules, which work in parallel. Output modules are separated by a comma. The Path must specify at least one input and one output. The syntax is as follows:

Path INPUT1[, INPUT2...] => [PROCESSOR1 [=> PROCESSOR2...] =>] OUTPUT1[, OUTPUT2...]

Example 1. Specifying routes

The following configuration shows the log router with modules being used in two routes.

nxlog.conf
<Input in1>
    Module  im_null
</Input>

<Input in2>
    Module  im_null
</Input>

<Processor p1>
    Module  pm_null
</Processor>

<Processor p2>
    Module  pm_null
</Processor>

<Output out1>
    Module  om_null
</Output>

<Output out2>
    Module  om_null
</Output>

<Route 1>
    # Basic route
    Path    in1 => out1
</Route>

<Route 2>
    # Complex route with multiple input, output, and processor modules
    Path    in1, in2 => p1 => p2 => out1, out2
</Route>

Optional directives

Priority

This directive takes an integer value in the range of 1-100 as a parameter, and the default is 10. Log messages in routes with a lower Priority value will be processed before others. Internally, this value is assigned to each module part of the route. The events of the modules are processed in priority order by the NXLog Agent engine. Modules of a route with a lower Priority value (higher priority) will process log messages first.

Example 2. Prioritized processing

This configuration prioritizes the UDP route over the TCP route to minimize the possibility of losing logs sent over UDP when the system is busy.

nxlog.conf
<Input tcp_listen>
    Module      im_tcp
    ListenAddr    0.0.0.0:1514
</Input>

<Input udp_listen>
    Module        im_udp
    ListenAddr    0.0.0.0:514
</Input>

<Output tcp_output>
    Module      om_file
    File        "/var/log/tcp.log"
</Output>

<Output udp_output>
    Module      om_file
    File        "/var/log/udp.log"
</Output>

<Route udp>
    Priority    1
    Path        udp_listen => udp_output
</Route>

<Route tcp>
    Priority    2
    Path        tcp_listen => tcp_output
</Route>