Logs
Scenarios
You can use logs when you want to know the statuses of messages published to a topic. Protocols including SMS, FunctionGraph (function), 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. For details about how to configure and operate LTS, see Log Tank Service User Guide.
Configuring Cloud Logs
- Create a log group.
- Log in to the LTS console.
- In the navigation pane on the left, choose Log Management.
The Log Management page appears.
- 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 SMN console.
- In the navigation pane on the left, choose Topic Management > Topics.
The Topics page appears.
- 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. Figure 1 Logs
- Click Start Logging and select the log group and log stream that you have created on the LTS console. Figure 2 Configure Log
- 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 log fields.
| Parameter | Type | Description |
|---|---|---|
| message_id | String | Message ID |
| project_id | String | Project ID |
| topic_urn | String | Unique resource identifier of a topic |
| subscriber_urn | String | Unique resource identifier of a subscriber |
| protocol_name | String | The subscription protocol. (Different protocols indicate different types of endpoints to receive messages.) The following protocols are supported:
|
| endpoint | String | Message receiving endpoint |
| status | String | Message status. The options are as follows:
|
| 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 | 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"} Table 2 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 |
What is your overall rating for this page?
Thank 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