All Products
Search
Document Center

ApsaraMQ for RabbitMQ:Log management

Last Updated:Sep 26, 2025

The log management feature automatically pushes the operation logs of your ApsaraMQ for RabbitMQ instances to a Logstore in Simple Log Service. If an exception occurs when a message is sent, consumed, or acknowledged, you can query and analyze the operation logs in Simple Log Service to diagnose the issue.

Prerequisites

  • Create an ApsaraMQ for RabbitMQ instance. For more information, see Instance management.

  • Activate Simple Log Service and create a project and a Logstore. For more information, see Resource hierarchy.

  • As prompted in the console, create and authorize the AliyunServiceRoleForAmqpLogDelivery service-linked role to push logs to Simple Log Service.

Important

If you delete the project or Logstore, or revoke the permissions granted to ApsaraMQ for RabbitMQ, logs can no longer be pushed.

Billing

  • ApsaraMQ for RabbitMQ

    ApsaraMQ for RabbitMQ does not charge for the log management feature.

  • Simple Log Service

    After logs from ApsaraMQ for RabbitMQ are pushed to Simple Log Service, you are charged by Simple Log Service based on storage space, traffic, and the number of requests. For more information, see Billable items of pay-by-feature.

Log format

Log format description

Parameter

Description

Action

The request method for the operation. For more information about the values and descriptions, see Action request methods.

Code

The status code. Valid values:

  • 200: The request is successful.

  • 541: An internal server error occurred.

  • 503: The command is invalid.

  • 530: The operation is not allowed.

  • 404: The resource does not exist.

  • 406: The precheck failed.

  • 403: A permission error occurred.

Info

This parameter is not returned if the request is successful. If the request fails, this parameter provides information about the error.

InstanceId

The ID of the ApsaraMQ for RabbitMQ instance. You can view the instance ID on the Instance Details or Overview page in the ApsaraMQ for RabbitMQ console.

Queue

The queue that corresponds to the subscription or message.

  • If Action is PushMessage, BasicGet, or DeleteMessage, this is the subscribed queue.

  • If Action is BasicReject, this is the queue of the rejected message.

  • If Action is BasicNack, this is the queue of the Nack'd message.

Property

The properties of the message. The following properties are available:

  • consumerTag: Identifies a subscriber to the queue.

  • deliveryTag: A unique identifier for a message on a channel, assigned by the server.

    Note

    This field is recorded only when Action is PushMessage, BasicGet, DeleteMessage, or SendDlqMessage.

RemoteAddress

The address of the client that initiated the operation.

  • If Action is SendMessage, this is the producer client address.

  • If Action is PushMessage, this is the consumer client address.

  • If Action is BasicAck, this is the consumer client address.

  • If Action is DeleteMessage, this is the consumer client address.

Note

This field is not recorded when Action is SendDlqMessage.

ReqUid

The account ID.

  • If you use a Resource Access Management (RAM) user to send and receive messages, this is the RAM user ID.

  • If you use an Alibaba Cloud account to send and receive messages, this is the Alibaba Cloud account ID.

Note

This field is not recorded when Action is SendDlqMessage.

ResourceName

The name of the resource.

  • messageId: The message ID set by the SDK when the message is sent.

  • exchange: The name of the exchange. You can view the exchange name on the Exchange Management page in the ApsaraMQ for RabbitMQ console.

  • routingKey: The routing key set by the SDK when the message is sent.

Note

This field is not recorded when Action is ConnectionOpen, ConnectionClose, ChannelOpen, or ChannelClose.

VHost

The name of the vhost. You can view the vhost name on the Vhost Management page in the ApsaraMQ for RabbitMQ console.

ConnectionId

A unique identifier for the connection, assigned by the server.

Note

This field is not recorded when Action is SendDlqMessage.

ChannelId

The channel ID generated by the client to uniquely identify the channel within the current connection.

Note

If Action is ConnectionOpen or ConnectionClose, the value is null.

microtime

The time when the request occurred, in microseconds.

_source_

This is a reserved field in Simple Log Service (SLS). For more information, see Reserved fields.

__tag__:__receive_time__

This is a reserved field in SLS. For more information, see Reserved fields.

__topic__

This is a reserved field in SLS. For more information, see Reserved fields.

Action request methods

Request method

Description

ConnectionOpen

Opens a connection.

ConnectionClose

Closes a connection.

ChannelOpen

Opens a channel.

ChannelClose

Closes a channel.

QueueDeclare

Creates a queue.

QueueDelete

Deletes a queue.

ExchangeDeclare

Creates an exchange.

ExchangeDelete

Deletes an exchange.

ExchangeBind

Binds a route to an exchange.

ExchangeUnBind

Unbinds a source exchange from a destination exchange.

QueueBind

Binds a route to a queue.

QueueUnbind

Unbinds a source exchange from a destination queue. The binding that you remove contains the code x0005.

SendMessage

A producer sends a message.

PushMessage

The server pushes a message.

BasicGet

A client pulls a message.

BasicAck

Acknowledges a message.

BasicConsume

Subscribes to a queue.

BasicReject

Rejects a message.

BasicRecover

Message recovery.

BasicNack

NACK message.

BasicQos

Sets the flow control for a consumer.

QueuePurge

Deletes all messages from a queue.

DeleteMessage

The server deletes a message after receiving a Basic.Ack from the client.

SendDlqMessage

Sends a message to a dead-letter queue.

Procedure

Configure your ApsaraMQ for RabbitMQ instance to push logs to Simple Log Service.

  1. Log on to the ApsaraMQ for RabbitMQ console. In the left-side navigation pane, click Instances.

  2. In the top navigation bar of the Instances page, select the region where the instance that you want to manage resides. Then, in the instance list, click the name of the instance that you want to manage.

  3. In the navigation pane on the left, click Log Management.

  4. On the My Resources card, click Authorize Now.

    If you have already granted ApsaraMQ for RabbitMQ access to Simple Log Service, you can skip this step.

  5. On the Log Management page, select the project that you created from the Project Name list, select the Logstore that you created from the Logstore list, and then click Enable.

  6. Log on to the Simple Log Service console, enable indexing, and configure index fields. For more information, see Create indexes.

  7. Manually add the __tag__:__receive_time__ field and set its alias to timestamp, as shown in the following figure.image

Tutorials