All Products
Search
Document Center

ApsaraMQ for RabbitMQ:Message log management

更新時間:Dec 20, 2024

The message log management feature of ApsaraMQ for RabbitMQ allows you to push the message logs of ApsaraMQ for RabbitMQ instances to Simple Log Service Logstores. If errors occur during message sending, consumption, or acknowledgment, you can query and analyze message logs in Simple Log Service to troubleshoot the errors.

Prerequisites

  • An ApsaraMQ for RabbitMQ instance is created. For more information, see Manage instances.

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

  • The service-linked role AliyunServiceRoleForAmqpLogDelivery is created and the required permissions are granted to the role. ApsaraMQ for RabbitMQ can assume the role to push message logs to Simple Log Service.

Important

If you delete the created Simple Log Service project or Logstore or revoke the permissions granted to ApsaraMQ for RabbitMQ, message logs cannot be pushed as expected.

Billing

  • ApsaraMQ for RabbitMQ

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

  • Simple Log Service

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

Log format

Log format description

Parameter

Description

Action

The request method that corresponds to the operation. For more information, see Request methods.

Code

The status code. Valid values:

  • 200: The request is successful.

  • 541: An internal 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

If the request is successful, this parameter is not displayed. If the request fails, the information about the status code is displayed.

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 is specified in the subscription or the queue in which one or more messages are rejected or negatively acknowledged.

  • If the value of the Action parameter is PushMessage, BasicGet, or DeleteMessage, this parameter indicates the queue that is specified in the subscription.

  • If the value of the Action parameter is BasicReject, this parameter indicates the queue in which a message is rejected.

  • If the value of the Action parameter is BasicNack, this parameter indicates the queue in which one or more messages are negatively acknowledged.

Property

The message attribute. Valid values:

  • consumerTag: the tag that is used to identify the consumer that subscribes to a message in a queue.

  • deliveryTag: the tag that is assigned by the broker to a message to uniquely identify the message on a channel.

    Note

    This parameter is returned only if the value of the Action parameter is PushMessage, BasicGet, DeleteMessage, or SendDlqMessage.

RemoteAddress

The IP address of the client from which the operation is initiated.

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

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

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

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

Note

If the value of the Action parameter is SendDlqMessage, this parameter is not returned.

ReqUid

The account ID.

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

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

Note

If the value of the Action parameter is SendDlqMessage, this parameter is not returned.

ResourceName

The resource name.

  • messageId: the message ID that you specify when you send the message by using an SDK.

  • exchange: the exchange name. You can view the exchange name on the Exchanges page in the ApsaraMQ for RabbitMQ console.

  • routingKey: the routing key that you specify when you send the message by using an SDK.

Note

If the value of the Action parameter is ConnectionOpen, ConnectionClose, ChannelOpen, or ChannelClose, this parameter is not returned.

VHost

The vhost name. You can view the vhost name on the vhosts page in the ApsaraMQ for RabbitMQ console.

ConnectionId

The connection ID. The ID is assigned by the broker to uniquely identify the connection.

Note

If the value of the Action parameter is SendDlqMessage, this parameter is not returned.

ChannelId

The channel ID. The ID is generated by the client to uniquely identify the channel in the connection.

Note

If the value of the Action parameter is ConnectionOpen or ConnectionClose, an empty value is returned.

microtime

The time when the request is initiated. Unit: microseconds.

_source_

A reserved field of Simple Log Service. For more information, see Reserved fields.

__tag__:__receive_time__

A reserved field of Simple Log Service. For more information, see Reserved fields.

__topic__

A reserved field of Simple Log Service. For more information, see Reserved fields.

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

QueueUnbind

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

SendMessage

Sends a message from a producer.

PushMessage

Pushes a message from a broker.

BasicGet

Pulls a message from a client.

BasicAck

Acknowledges the consumption of a message.

BasicConsume

Subscribes to a message in a queue.

BasicReject

Rejects a message.

BasicRecover

Redelivers unacknowledged messages.

BasicNack

Negatively acknowledges one or more messages.

BasicQos

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

QueuePurge

Removes all messages from a queue.

DeleteMessage

Deletes a message. If the client calls the BasicAck method after the DeleteMessage method is called, the broker confirms that the message is deleted.

SendDlqMessage

Sends a message to a dead-letter queue.

Procedure

Configure a logging bucket for the ApsaraMQ for RabbitMQ instance that you created to push message 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 left-side navigation pane, click Log Management.

  4. (Optional) On the Service-linked Role for Message Queue for RabbitMQ page, click Authorize.

    If ApsaraMQ for RabbitMQ is authorized to access Simple Log Service, skip this step.

  5. On the Log Management page, select the project to which you want to push message logs from the Project Name drop-down list, select the Logstore to which you want to push message logs from the Logstore drop-down list, and then click Enable.

  6. Log on to the Simple Log Service console and configure indexes for log fields. For more information, see Create indexes.

  7. Add the __tag__:__receive_time__ field, specify timestamp as the alias, and then configure an index for the field, as shown in the following figure.image

Best practices