The Redis Input allows consuming messages from Redis pub/sub channels. It supports subscribing to multiple channels or channel patterns and can process messages in raw or JSON format.
"inputs": {
"redis": {
"type": "redis",
"config": {
"url": "redis://localhost",
"channels": ["test*", "input", "logs_*"],
"format": "raw"
}
}
}"inputs": {
"redis": {
"type": "redis",
"config": {
"url": "redis://localhost",
"channels": "events",
"format": "json"
}
}
}-
url:
A string or an array of strings specifying the Redis host(s) to connect to.- If Redis supports clustering, it will use cluster mode and autodiscover hosts.
- If clustering is not supported, the first URL will be used for the connection.
Defaults toredis://localhost:6379.
-
channels:
A string or an array of strings specifying the Redis channels to subscribe to.- Supports Redis channel patterns (e.g.,
test*,logs_*).
- Supports Redis channel patterns (e.g.,
-
format:
Specifies the message format.- raw: The raw content of the message is placed in the
originalMessagefield. - json: The message content is parsed as a JSON object and placed in the
originalMessagefield.
Defaults to raw.
- raw: The raw content of the message is placed in the
Each message received from Redis generates an object with the following schema:
{
id: '<input ID>',
type: 'redis',
channel: '<channel name>',
originalMessage: '<String value or JSON object>'
}- If the
formatis set to json, the input will attempt to parse the message content as JSON. If parsing fails, a warning will be logged, and the raw message will be returned. - The
channelfield indicates the name of the channel from which the message was received. - This input supports both single-node Redis and Redis clusters.