All Products
Search
Document Center

ApsaraMQ for RabbitMQ:Logs

Last Updated:Jul 08, 2026

The message log management feature automatically pushes operation logs from an ApsaraMQ for RabbitMQ instance to a Simple Log Service Logstore. If an error occurs during message sending, consumption, or acknowledgment, you can query and analyze these logs in Simple Log Service to diagnose the issue.

Prerequisites

  • You have created an ApsaraMQ for RabbitMQ instance. For more information, see Manage instances.

  • You have activated Simple Log Service and created a project and a Logstore. For more information, see Resource management overview.

  • Create the AliyunServiceRoleForAmqpLogDelivery service-linked role and grant it the required permissions when prompted in the console. This role pushes logs to your Simple Log Service.

Important

If you delete the project or Logstore, or revoke permissions from ApsaraMQ for RabbitMQ, log delivery will fail.

Billing

  • ApsaraMQ for RabbitMQ

    You are not charged for using the message log management feature.

  • Simple Log Service

    After ApsaraMQ for RabbitMQ pushes logs to Simple Log Service, you are charged for items like storage, traffic, and requests. For more information, see Billable items of pay-as-you-go.

Log format

Log schema

Parameter

Description

Action

The request method for the operation. For valid 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 field is empty for successful requests. For failed requests, it provides details about the error status code.

InstanceId

The ID of the ApsaraMQ for RabbitMQ instance. The instance ID is available on the Instance Details or Overview page in the ApsaraMQ for RabbitMQ console.

Queue

The queue associated with the subscription or message.

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

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

  • If the Action is BasicNack, this field indicates the queue of the Nack-ed message.

Property

The message attributes. Valid values:

  • consumerTag: The tag that identifies a subscriber to the queue.

  • deliveryTag: A server-side tag that uniquely identifies a message on a channel.

    Note

    This field is logged only if the Action is PushMessage, BasicGet, DeleteMessage, or SendDlqMessage.

RemoteAddress

The IP address of the client that initiated the operation.

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

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

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

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

Note

This field is not logged if the Action is SendDlqMessage.

ReqUid

The account ID.

  • If a RAM user sends or receives messages, this field shows the RAM user ID.

  • If an Alibaba Cloud account sends or receives messages, this field shows the Alibaba Cloud account ID.

Note

This field is not logged if the Action is SendDlqMessage.

ResourceName

The resource name.

  • messageId: The message ID that you set when you send a message by using an SDK.

  • exchange: The name of the exchange. The name is available on the Exchanges page in the ApsaraMQ for RabbitMQ console.

  • routingKey: The routing key that you set when you send a message by using an SDK.

Note

This field is not logged if the Action is ConnectionOpen, ConnectionClose, ChannelOpen, or ChannelClose.

VHost

The vhost name. The name is available on the vhosts page in the ApsaraMQ for RabbitMQ console.

ConnectionId

The server-side ID that uniquely identifies a connection.

Note

This field is not logged if the Action is SendDlqMessage.

ChannelId

The client-generated ID that uniquely identifies a channel within the current connection.

Note

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

microtime

The timestamp of the request in microseconds.

_source_

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

__tag__:__receive_time__

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

__topic__

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

Action request methods

Request method

Description

ConnectionOpen

Establishes 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 source exchange to a destination exchange.

ExchangeUnBind

Unbinds a source exchange from a destination exchange.

QueueBind

Binds a queue to an exchange.

QueueUnbind

Unbinds a queue from an exchange.

SendMessage

A producer sends a message.

PushMessage

A broker pushes a message.

BasicGet

A client pulls a message.

BasicAck

Acknowledges the consumption of a message.

BasicConsume

Subscribes to a queue.

BasicReject

Rejects a message.

BasicRecover

Redelivers unacknowledged messages.

BasicNack

Negatively acknowledges a message.

BasicQos

Limits the number of unacknowledged messages that can be prefetched by a consumer.

QueuePurge

Removes all messages from a queue.

DeleteMessage

The server deletes a message after receiving a client's Basic.Ack acknowledgment.

SendDlqMessage

Sends a dead-letter message.

Procedure

To push logs from your ApsaraMQ for RabbitMQ instance to Simple Log Service, configure a destination.

  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 left-side navigation pane, click Log Management.

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

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

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

  6. Log on to the Simple Log Service console. Enable and configure field indexes for your logs. For more information, see Create indexes.

  7. Manually add the __tag__:__receive_time__ field and set its alias to timestamp.

Tutorials

  • Common queries for troubleshooting

  • How to generate second-level metrics

  • Count message send/receive operations by queue to identify high-cost queues

    When the ApsaraMQ for RabbitMQ console does not provide queue-level billing breakdowns, you can use the operation logs in Simple Log Service to independently count message operations by queue and locate high-consumption queues, without relying on backend data extraction.

    In Simple Log Service, query the operation logs of your ApsaraMQ for RabbitMQ instance and run the following query statement to aggregate the number of SendMessage, PushMessage, and BasicGet operations per queue within a specified time range, sorted by operation count in descending order:

    Action: SendMessage OR Action: PushMessage OR Action: BasicGet | SELECT Queue, Action, COUNT(*) AS operation_count GROUP BY Queue, Action ORDER BY operation_count DESC LIMIT 100

    Action

    Description

    SendMessage

    A producer sends a message to ApsaraMQ for RabbitMQ.

    PushMessage

    The broker pushes a message to a consumer.

    BasicGet

    A consumer client pulls a message.

    The results show which queues have the highest message throughput. Use these results to pinpoint the source of high costs and prioritize optimization without waiting for backend data extraction.

FAQ

Q: Why is there a time difference between the client log timestamp and the server delivery success time in ApsaraMQ for RabbitMQ?

A: To troubleshoot this discrepancy, follow these steps:

  1. Check server-side logs first. Query the operation logs in Simple Log Service to verify that the server delivered the message successfully and without delay. Filter by Action: PushMessage OR Action: DeleteMessage and confirm that the Code field value is 200. If the server-side logs are normal, the server is not the cause of the time difference.

  2. Investigate the client environment. If the server-side logs show no issues, the discrepancy is typically caused by the client side. Check for the following conditions:

    • Network latency or packet loss: Intermittent network issues between the client and the ApsaraMQ for RabbitMQ service can delay message acknowledgment on the client side.

    • High CPU usage: A heavily loaded CPU can delay the execution of message-sending methods (for example, convertAndSend), causing the client-recorded timestamp to lag behind the server's actual delivery time.

    • Frequent Full GC pauses: JVM Full GC events pause all application threads, which can significantly increase the time between invoking a send method and actual message delivery. This causes the client log to record a later timestamp than the server's delivery time.

Q: How do I analyze the cause of an issue after receiving an alarm log or alert notification from ApsaraMQ for RabbitMQ?

A: When you receive an alarm log or alert notification, follow these steps to identify the root cause:

  1. Locate the console link in the alarm log. Alarm logs include a URL that directs you to the relevant monitoring or management page in the cloud console. Find this URL in the alarm log content.

  2. Open the Task Details page. Click the URL in the alarm log to access the Task Details page or the cluster monitoring page directly. This page provides the alarm context, associated metrics, and event timeline to help you diagnose the underlying issue.

  3. Correlate with operation logs. Cross-reference the alarm event timestamp with the operation logs in Simple Log Service to identify correlated message operations (such as connection failures, message rejections, or dead-letter routing) that occurred at the same time and may have contributed to the alarm.