The ZeroMQ Input creates a ZeroMQ client to consume messages from a publisher. It supports two modes: pull and sub. Messages can be processed in raw or JSON format.
"inputs": {
"zmq": {
"type": "zmq",
"config": {
"url": "tcp://127.0.0.1:9999",
"mode": "sub",
"channel": "my_channel",
"format": "json"
}
}
}"inputs": {
"zmq": {
"type": "zmq",
"config": {
"url": "tcp://127.0.0.1:8888",
"mode": "pull",
"format": "raw"
}
}
}"inputs": {
"zmq": {
"type": "zmq",
"config": {
"url": "tcp://127.0.0.1:7777",
"mode": "sub",
"channel": "logs_*",
"format": "json"
}
}
}-
url:
The connection URL for the ZeroMQ socket. Example:tcp://127.0.0.1:9999. -
mode:
The mode of operation.- pull: Connects to a
PUSHsocket to receive messages. - sub: Connects to a
PUBsocket and subscribes to a specific channel.
- pull: Connects to a
-
channel:
The channel to subscribe to (only applicable insubmode). Supports exact channel names or wildcard patterns. -
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.
- raw: The raw content of the message is placed in the
Each message received from ZeroMQ generates an object with the following schema:
{
id: '<input ID>',
type: 'zmq',
mode: '<sub or pull>',
url: '<Connection URL>',
originalMessage: '<raw data or JSON object>',
topic: '<channel name>' // Only present in `sub` mode
}- 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
topicfield is only present insubmode and indicates the name of the channel from which the message was received. - The
pullmode does not use channels and processes all incoming messages.