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
AliyunServiceRoleForAmqpLogDeliveryservice-linked role to push logs to Simple Log Service.
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:
|
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.
|
Property | The properties of the message. The following properties are available:
|
RemoteAddress | The address of the client that initiated the operation.
Note This field is not recorded when Action is SendDlqMessage. |
ReqUid | The account ID.
Note This field is not recorded when Action is SendDlqMessage. |
ResourceName | The name of the resource.
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 |
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.
Log on to the ApsaraMQ for RabbitMQ console. In the left-side navigation pane, click Instances.
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.
In the navigation pane on the left, click Log Management.
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.
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.
Log on to the Simple Log Service console, enable indexing, and configure index fields. For more information, see Create indexes.
Manually add the
__tag__:__receive_time__field and set its alias to timestamp, as shown in the following figure.