You can use the message log management feature of Message Queue for RabbitMQ to push message logs of a Message Queue for RabbitMQ instance to Log Service. If an exception occurs when a message is sent, consumed, or acknowledged, you can query message logs by message ID and diagnose the exception.

Prerequisites

Before you push message logs of a Message Queue for RabbitMQ instance to Log Service, make sure that the following operations are complete:

Scenarios

The message log management feature of Message Queue for RabbitMQ is used in the following scenarios:
  • Troubleshoot exceptions. For example, a message is sent, but the consumer does not receive this message.
  • View information about consumers or the number of times a message is consumed.
  • View message logs that were generated a month ago or earlier.

Usage notes

  • If you delete the created project and Logstore or revoke the permissions granted to Message Queue for RabbitMQ, logs cannot be pushed.
  • To facilitate query of message logs, we recommend that you specify the message ID when you use an SDK to send or receive messages. For more information, see How do I specify a message ID?.
  • You can configure logging buckets for each Message Queue for RabbitMQ instance. By default, logging buckets are not configured.
  • After message logs of Message Queue for RabbitMQ are pushed to Log Service, you are charged based on items such as storage space, traffic, and the number of requests. For more information, see Billing overview.

Procedure

Configure a logging bucket for a Message Queue for RabbitMQ instance to push logs to Log Service.

  1. Log on to the Message Queue for RabbitMQ console.
  2. In the top navigation bar, select the region where your instance resides.
  3. In the left-side navigation pane, click Logging.
  4. Optional:In the Service-linked Role for Message Queue for RabbitMQ message, click Authorize.
    If Message Queue for RabbitMQ is granted the permissions to access cloud resources, skip this step.
  5. On the Logging page, select an instance and click Configure in the Actions column.
  6. In the Configure dialog box, select a project that you created from the Project Name drop-down list, select a Logstore that you created from the Logstore Name drop-down list, and then click OK.

What to do next

After the message logs of a Message Queue for RabbitMQ instance are pushed to Log Service, you can query and analyze the logs. For more information, see Query logs.
Parameter Description
Action The action. Valid values:
  • MessagePublish: Publish a message.
  • MessageAck: Acknowledge a message.
  • MessageReceived: Consume a message.
Code The HTTP status code. Valid values:
  • 200: The request is successful.
  • 541: An error occurs on the server.
  • 503: The command is invalid.
  • 530: The operation is not allowed.
  • 404: The resource does not exist.
  • 406: The precheck fails.
  • 403: A permission error occurs.
Exchange The name of the exchange. You can view the exchange name on the Exchanges page of the Message Queue for RabbitMQ console.
Info This parameter is left empty when a request is successful. Otherwise, information about the returned HTTP status code is displayed.
InstanceId The ID of the Message Queue for RabbitMQ instance. You can view the instance ID on the Instances page or Overview page of the Message Queue for RabbitMQ console.
MessageId The message ID that is specified when you use an SDK to send the message.
OwnerUid The ID of the Alibaba Cloud account. You can obtain the account ID in the Alibaba Cloud Management Console.
Queues Information about queues. An information entry consists of the queue name and a unique message ID that is automatically generated by the system. Multiple information entries are separated by vertical bars (|). If the Action parameter is set to MessageAck, the information entry contains only the unique message ID that is automatically generated by the system.
RemoteAddress
  • If the Action parameter is set to MessagePublish, the value of this parameter is the address of the producer client.
  • If the Action parameter is set to MessageAck, the value of this parameter is the address of the consumer client.
  • If the Action parameter is set to MessageReceived, the value of this parameter is the address of the consumer client.
ReqUid
  • If you send or receive messages by using a RAM user, the value of this parameter is the ID of the RAM user.
  • If you send or receive messages by using your Alibaba Cloud account, the value of this parameter is the ID of the Alibaba Cloud account.
Routingkey The routing key that is specified when you use an SDK to send messages.
VHost The name of the vhost. You can view the vhost name on the vhosts page of the Message Queue for RabbitMQ console.
_source_ This parameter is an internal parameter that is used by the Message Queue for RabbitMQ service team. You do not need to pay attention to this parameter.
__tag__:__receive_time__ This parameter is an internal parameter that is used by the Message Queue for RabbitMQ service team. You do not need to pay attention to this parameter.
__topic__ This parameter is an internal parameter that is used by the Message Queue for RabbitMQ service team. You do not need to pay attention to this parameter.