Redis (im_redis)
This module can retrieve data stored in a Redis server. The module issues LPOP commands using the Redis Protocol to pull data.
The output counterpart, om_redis, can be used to populate the Redis server with data.
Configuration
The im_redis 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.
This mandatory directive specifies the IP address or DNS hostname of the Redis server to connect to. The module works in a failover configuration if additional hosts are specified on new lines. If a host is unreachable, the module automatically fails over to the next one. If the last host is unreachable, the module will fail over to the first host. |
Optional directives
Optional directive to define the Redis channel(s) to subscribe to.
The default is |
|
This optional directive can be used to choose between the LPOP (the default), RPOP, SUBSCRIBE, and PSUBSCRIBE commands. |
|
See the InputType directive in the list of common module directives.
The default is the |
|
This specifies the Key used by the LPOP command.
The default is |
|
This optional directive specifies the local port number of the connection. If not specified, a random high port number will be used, which may be unsuitable for firewalled network environments. |
|
This directive specifies how frequently the module will check for new data, in seconds.
If this directive is not specified, the default is 1 second. Fractional seconds may be specified ( |
|
This specifies the port number of the Redis server. The default is port 6379. |
Examples
This configuration only sets the mandatory Host directive to the Redis server IP address.
The module default will use the LPOP
command to retrieve logs from a key named nxlog
.
<Input redis>
Module im_redis
Host 192.168.1.213
</Input>
The configuration below sets the mandatory Host directive to the Redis server IP address.
It also specifies the Command and Key directives to use the RPOP
command for retrieving logs from a key named event_logs
.
<Input redis>
Module im_redis
Host 192.168.1.213
Command RPOP
Key event_logs
</Input>
The configuration below sets the mandatory Host directive to the Redis server IP address.
It also specifies the Command and multiple Channel directives for subscribing to any Redis channel names ending with _metrics
or _logs
.
<Input redis>
Module im_redis
Host 192.168.1.213
Command PSUBSCRIBE
Channel *_metrics
Channel *_logs
</Input>