Skip to main content
Version: 1.5.1

RabbitMQ

RabbitMQ Message Queue

Synopsis

Creates a target that publishes log messages to RabbitMQ exchanges or queues with support for batching, routing, TLS encryption, and automatic retry logic. RabbitMQ is a widely-used open-source message broker for reliable message delivery.

Schema

- name: <string>
description: <string>
type: rabbitmq
pipelines: <pipeline[]>
status: <boolean>
properties:
url: <string>
exchange: <string>
routing_key: <string>
queue: <string>
content_type: <string>
delivery_mode: <integer>
mandatory: <boolean>
immediate: <boolean>
timeout: <integer>
batch_size: <integer>
max_retries: <integer>
retry_delay: <integer>
field_format: <string>
tls:
status: <boolean>
verify: <boolean>
cert_name: <string>
key_name: <string>
min_tls_version: <string>
max_tls_version: <string>
interval: <string|numeric>
cron: <string>
debug:
status: <boolean>
dont_send_logs: <boolean>

Configuration

The following fields are used to define the target:

FieldRequiredDefaultDescription
nameYTarget name
descriptionN-Optional description
typeYMust be rabbitmq
pipelinesN-Optional post-processor pipelines
statusNtrueEnable/disable the target

Connection

FieldRequiredDefaultDescription
urlY-RabbitMQ server URL (e.g., amqp://localhost:5672 or amqps://host:5671)
timeoutN30Connection timeout in seconds

Routing Configuration

FieldRequiredDefaultDescription
exchangeN*-RabbitMQ exchange name
routing_keyN-Routing key for message delivery (defaults to queue name if queue is specified)
queueN*-RabbitMQ queue name (queue will be declared as durable)

* = Conditionally required. Either exchange or queue must be specified. If queue is specified without routing_key, the queue name is used as the routing key.

Message Properties

FieldRequiredDefaultDescription
content_typeNapplication/jsonMessage content type
delivery_modeN2Delivery mode: 1 (non-persistent), 2 (persistent)
mandatoryNfalseRequire message to be routed to at least one queue
immediateNfalseRequire immediate delivery to consumer (deprecated in RabbitMQ 3.x)

Batch Configuration

FieldRequiredDefaultDescription
batch_sizeN1000Number of messages to batch before publishing (minimum 1)
max_retriesN3Maximum retry attempts for failed publish operations
retry_delayN1Delay between retry attempts in seconds

Processing

FieldRequiredDefaultDescription
field_formatN-Data normalization format. See applicable Normalization section

TLS Configuration

FieldRequiredDefaultDescription
tls.statusNfalseEnable TLS encryption
tls.verifyNtrueVerify server TLS certificate
tls.cert_nameN*-Client certificate filename (PEM format)
tls.key_nameN*-Client private key filename (PEM format)
tls.min_tls_versionNtls1.2Minimum TLS version: tls1.0, tls1.1, tls1.2, tls1.3
tls.max_tls_versionNtls1.3Maximum TLS version: tls1.0, tls1.1, tls1.2, tls1.3

* = Conditionally required. Both cert_name and key_name must be provided together or omitted together.

Scheduler

FieldRequiredDefaultDescription
intervalNrealtimeExecution frequency. See Interval for details
cronN-Cron expression for scheduled execution. See Cron for details

Debug Options

FieldRequiredDefaultDescription
debug.statusNfalseEnable debug logging
debug.dont_send_logsNfalseProcess logs but don't send to target (testing)

Details

The RabbitMQ target publishes log messages to RabbitMQ exchanges or directly to queues. Messages are accumulated in batches and published when the batch size is reached. Each message is published with automatic retry logic for handling transient failures.

The target maintains a persistent connection to the RabbitMQ server with thread-specific channels for concurrent operations. If a queue is specified during initialization, it is automatically declared as a durable queue.

Message timestamps are set to the log event epoch time, and messages can be configured as persistent (surviving broker restarts) or non-persistent for maximum throughput.

Prerequisites

  1. A running RabbitMQ server
  2. Network connectivity to the RabbitMQ server
  3. Valid authentication credentials (included in the URL)
  4. Exchange must exist if publishing to an exchange (unless auto-creation is enabled)
  5. TLS certificates if using encrypted connections
note

Either exchange or queue must be specified. When using queue, the queue is automatically declared as durable. When using exchange, ensure the exchange exists on the RabbitMQ server.

warning

Both tls.cert_name and tls.key_name must be provided together when using client certificate authentication. Providing only one will result in a configuration error.

note

The immediate flag is deprecated in RabbitMQ 3.x and later. Setting it to true may cause errors with modern RabbitMQ servers.

Examples

Basic Queue

Minimum configuration for publishing to a queue:

targets:
- name: basic_rabbitmq
type: rabbitmq
properties:
url: "amqp://guest:guest@localhost:5672"
queue: "logs"

Exchange with Routing

Configuration for publishing to an exchange with routing key:

targets:
- name: exchange_rabbitmq
type: rabbitmq
properties:
url: "amqp://logger:password@rabbitmq.example.com:5672"
exchange: "logs.topic"
routing_key: "application.logs"

Persistent Messages

Configuration with persistent message delivery:

targets:
- name: persistent_rabbitmq
type: rabbitmq
properties:
url: "amqp://logger:password@rabbitmq.example.com:5672"
queue: "durable_logs"
delivery_mode: 2

With TLS

Configuration with TLS encryption:

targets:
- name: secure_rabbitmq
type: rabbitmq
properties:
url: "amqps://logger:password@rabbitmq.example.com:5671"
queue: "secure_logs"
tls:
status: true
verify: true
min_tls_version: "tls1.2"

With Client Certificate

Configuration using mutual TLS with client certificates:

targets:
- name: mtls_rabbitmq
type: rabbitmq
properties:
url: "amqps://rabbitmq.example.com:5671"
queue: "secure_logs"
tls:
status: true
verify: true
cert_name: "client.pem"
key_name: "client-key.pem"
min_tls_version: "tls1.2"

Custom Batch Size

Configuration with custom batching and retry settings:

targets:
- name: batch_rabbitmq
type: rabbitmq
properties:
url: "amqp://logger:password@rabbitmq.example.com:5672"
queue: "highvolume_logs"
batch_size: 5000
max_retries: 5
retry_delay: 2
timeout: 60

With Normalization

Configuration using field normalization:

targets:
- name: normalized_rabbitmq
type: rabbitmq
properties:
url: "amqp://logger:password@rabbitmq.example.com:5672"
exchange: "logs.ecs"
routing_key: "normalized"
field_format: "ecs"

With Pipeline

Using a pipeline for additional log processing:

targets:
- name: pipeline_rabbitmq
type: rabbitmq
pipelines:
- enrich_logs
properties:
url: "amqp://logger:password@rabbitmq.example.com:5672"
queue: "enriched_logs"