The log management feature of Simple Message Queue (SMQ) pushes message request logs to Simple Log Service (SLS). You can then use SLS to query and analyze request logs to troubleshoot production issues.
Use cases
Common issues when sending and receiving messages:
-
A message is successfully sent to a queue, but the consumer client does not receive it. Where did the message go?
-
Who consumed a specific message? How many times was it consumed?
-
A consumer client crashes. When can a message that failed consumption be consumed again?
-
A message is published to a topic, but the endpoint hasn't received it after a long time. What is causing the delay?
Log management in SMQ addresses these issues:
-
Push logs to SLS and view the complete message trace in the console.
-
Use the query tool provided on the official website. You can specify parameters to view message processing logs.
Billing
-
SMQ does not charge extra fees for the log management feature.
-
When SMQ pushes logs to SLS, SLS charges you based on storage space, traffic, and request volume. Billing overview.
Queue log format
Queue message operations (send, consume, delete) generate log entries. The included fields vary by operation.
-
Log fields
Queue log entries can include the following fields.
Field
Description
Time
Operation timestamp.
MessageId
Unique message ID.
QueueName
Target queue name.
AccountId
Queue owner account ID.
RemoteAddress
Client IP address.
NextVisibleTime
When the message becomes visible again.
ReceiptHandleInRequest
ReceiptHandleprovided by the client.ReceiptHandleInResponse
ReceiptHandlereturned to the client.ProcessTime
Operation processing time.
RequestId
Request ID.
Action
The action, such as
DeleteMessageorSendMessage. -
Fields by operation
The following table shows which fields each operation includes.
Operation
Time
QueueName
AccountId
MessageId
RemoteAddress
NextVisibleTime
ReceiptHandleInResponse
ReceiptHandleInRequest
SendMessage/BatchSendMessage
Yes
Yes
Yes
Yes
Yes
Yes
No
No
PeekMessage/BatchPeekMessage
Yes
Yes
Yes
Yes
Yes
No
No
No
ReceiveMessage/BatchReceiveMessage
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
ChangeMessageVisibility
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
DeleteMessage/BatchDeleteMessage
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Topic log format
Topic message operations (publish and push) generate log entries. The included fields vary by operation.
-
Log fields
Topic log entries can include the following fields.
Field
Description
Time
Operation timestamp.
MessageId
Unique message ID.
TopicName
Target topic name.
SubscriptionName
Subscription name.
AccountId
Topic owner account ID.
RemoteAddress
Client IP address.
NotifyStatus
Status code or error from the endpoint when SMQ pushes a message.
ProcessTime
Operation processing time.
MessageTag
Message tag.
RequestId
Request ID.
Action
The action, such as
PublishMessageorNotify. -
Fields by operation
The following table shows which fields each operation includes.
Operation
Time
MessageId
TopicName
SubscriptionName
AccountId
RemoteAddress
NotifyStatus
MessageTag
PublishMessage
Yes
Yes
Yes
No
Yes
Yes
No
No
Notify
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
-
NotifyStatus
The NotifyStatus field in push logs indicates why SMQ failed to deliver a message. Troubleshoot based on the following values.
Error code
Description
Recommended action
2xx
The message was pushed successfully.
None.
Other HTTP status codes
Endpoint returned a non-2xx status code.
Check the processing logic at your endpoint.
InvalidHost
Invalid subscription endpoint.
Verify that the subscription endpoint is valid and accessible with
curlortelnet.ConnectTimeout
Connection to the subscription endpoint timed out.
Verify that the subscription endpoint is accessible with
curlortelnet.ConnectFailure
Connection to the subscription endpoint failed.
Verify that the subscription endpoint is accessible with
curlortelnet.UnknownError
An unknown error occurred.
Contact SMQ technical support.
Log operations
Before you use log management, ensure the following:
-
Create a queue and a topic in SMQ. Manage queues. Manage topics.
-
Create a project and a Logstore in SLS. Manage a Project. Create a Logstore.
Operation logs for your SMQ service can be pushed only to an SLS Project in the same region.
-
Authorize SMQ to export logs with the
AliyunMNSLoggingRoleRAM role.Click Cloud Resource Access Authorization and follow the on-screen instructions to complete the authorization.
WarningDo not revoke the authorization or delete the RAM role. Otherwise, SMQ logs cannot be pushed to SLS.
> Edit.






