Logs
Scenarios
You can use logs when you want to know the statuses of messages published to a topic. Protocols including SMS, email, HTTP and HTTPS are supported. Before configuring logs, you need to interconnect SMN with Log Tank Service (LTS) and have created a log group and log stream to be associated.
Configuring Cloud Logs
- Create a log group.
- Log in to the management console.
- Click on the upper left to select the desired region and project.
- Select Log Tank Service under Management & Governance.
The LTS console is displayed.
- In the navigation pane on the left, choose Log Management.
The Log Management page is displayed.
- Click Create Log Group. In the displayed dialog box, enter a log group name.
- Click OK.
- Create a log stream.
- Locate the created log group and click its name.
- Click Create Log Stream. In the displayed dialog box, enter a name for the log stream.
- Click OK.
Configuring Message Transmission Logs
On the SMN console, configure logs.
- Set this parameter on the Create Topic page.
- Log in to the management console.
- In the upper left corner of the page, click and select the desired region and project.
- Select Simple Message Notification under Application.
The SMN console is displayed.
- In the navigation pane on the left, choose Topic Management > Topics.
The Topics page is displayed.
- On the Topics page, click the name of the topic to be configured.
- On the displayed page, click the Message Transfer Logs tab, and click Configure Access Logs.
- Click Start Logging and select the log group and log stream that you have created on the LTS console.
- Click OK.
Viewing Access Logs
You can view details about logs you configured.
Log format
{"message_id":"$message_id","project_id":"$project_id","topic_urn":"$topic_urn","subscriber_urn":"$subscriber_urn","protocol_name":"$protocol_name","endpoint":"$endpoint","status":"$status","http_code":$http_code,"create_time":"$create_time","send_time":"$send_time"}
The log format cannot be modified. Table 1 describes the log fields.
Parameter |
Type |
Description |
---|---|---|
message_id |
String |
Message ID |
project_id |
String |
Project ID |
topic_urn |
String |
Resource identifier of a topic, which is unique |
subscriber_urn |
String |
Resource identifier of a subscription, which is unique |
protocol_name |
String |
Specifies the subscription protocol. (Different protocols indicate different types of endpoints to receive messages.) The following protocols are supported: Email: The endpoints are email addresses. SMS: The endpoints are phone numbers. FunctionGraph: FunctionGraph (function) transmission protocol. The endpoint is a function. FunctionStage: FunctionStage (workflow) transmission protocol. The endpoint is a function workflow. HTTP and HTTPS: The endpoints are URLs. |
endpoint |
String |
Message receiving endpoint |
status |
String |
Message status. The options are as follows: DELIVERED: The message has been delivered. FAIL_DELIVERED: The message fails to be sent. REJECTS: The message has been rejected. The flow control mechanism is triggered. |
http_code |
Integer |
HTTP return code. Only HTTP/HTTPS messages are supported. |
create_time |
String |
Time when a message was created. The UTC time is in YYYY-MM-DDTHH:MM:SSZ format. |
send_time |
String |
Specifies the time when the message was sent. The UTC time is in YYYY-MM-DDTHH:MM:SSZ format. |
Example Log
{"message_id":"1ae49922602a42fc83acb9689a2eb5f4","project_id":"5a9f32e4f1ec4bbe9695ff9da51c2925","topic_urn":"urn:smn:regionid:5a9f32e4f1ec4bbe9695ff9da51c2925:demo","subscriber_urn":"urn:smn:regionid:5a9f32e4f1ec4bbe9695ff9da51c2925:demo:b55c3c6fa7cd471b9f24818d530a8740","protocol_name":"https","endpoint":"https://127.0.0.1:443/https","status":"DELIVERED","http_code":200,"create_time":"2022-11-01T00:00:00Z","send_time":"2022-11-01T00:00:10Z"}
The following table describes the fields in the log.
Parameter |
Example Value |
---|---|
message_id |
1ae49922602a42fc83acb9689a2eb5f4 |
project_id |
5a9f32e4f1ec4bbe9695ff9da51c2925 |
topic_urn |
urn:smn:regionid:5a9f32e4f1ec4bbe9695ff9da51c2925:demo |
subscriber_urn |
urn:smn:regionid:5a9f32e4f1ec4bbe9695ff9da51c2925:demo:b55c3c6fa7cd471b9f24818d530a8740 |
protocol_name |
https |
endpoint |
https://127.0.0.1:443/https |
status |
DELIVERED |
http_code |
200 |
create_time |
2022-11-01T00:00:00Z |
send_time |
2022-11-01T00:00:10Z |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot