tencent cloud

Log Shipping
Last updated:2025-10-15 20:18:39
Log Shipping
Last updated: 2025-10-15 20:18:39
TencentDB for PostgreSQL provides a log shipping feature. Through log shipping, you can collect slow log and error log data from TencentDB for PostgreSQL instances and ship it to Cloud Log Service (CLS) for analysis, enabling quick monitoring and troubleshooting of business issues. This document describes how to enable or disable the log shipping feature via the console.

Prerequisites

Before using this feature, please ensure:
The CLS has been successfully activated.
A service role for PostgreSQL has been created and the necessary permissions have been granted.

Definition of Error Logs

Field value.
Type
Description
Timestamp
-
A reserved field for CLS, which represents the log generation time.
InstanceId
String
Database instance ID, such as postgres-xxx.
Database
Long
The database used by the client to connect to the database instance.
UserName
String
The username used by the client to connect to the database instance.
ErrMsg
String
Original SQL error logs.
ErrTime
String
Error occurrence time.

Definition of Slow Logs

Field value.
Type
Description
Timestamp
-
A reserved field for CLS, which represents the log generation time.
InstanceId
String
Database instance ID, such as postgres-xxx.
DatabaseName
String
The database to which the client connects.
UserName
String
User of client connection.
RawQuery
String
Slow log content.
Duration
String
Duration.
ClientAddr
String
Client address.
SessionStartTime
Unix timestamp
Session start time.

Enabling Slow Log Shipping

1. Log in to the TencentDB for PostgreSQL console and click Instance ID in the instance list to go to the management page.
2. On the instance management page, select Performance Optimization > Log Shipping.
3. In the Slow Query Log Shipping section, click the Enable Now button.

4. Complete the following configuration in the pop-up window, and click Enable Now.

Parameter
Description
Destination region
Select the region for log shipping, supporting offsite shipping.
Log topic operations
Log topics serve as the fundamental units for collecting, storing, retrieving, and analyzing log data. You can either select an existing log topic or create a new one.
Logset
Logsets serve as a classification mechanism for log topics, enabling efficient management of log topics. You can either select existing log topics or create new ones as needed.
Select an existing logset: You can filter existing logsets in the search box to categorize slow log shipping.
Create a logset: You can create a new logset to categorize slow log shipping. Only English letters, digits, and underscores are supported, and the length cannot exceed 20.
Log Topic
Select an existing log topic: This option is available only when an existing logset is selected. You can filter log topics under the selected logset in the search box.
Create a log topic: Create a new log topic under the selected logset. Only English letters, digits, and underscores are supported, and the length cannot exceed 20.
Note:
You can manage log topics. For details, see Managing Log Topics.
Note:
Enabling log delivery will automatically activate log indexing by default. It is enabled by default. Index configuration is a necessary condition to use CLS for retrieval and analysis. Only by enabling the indexing feature can you retrieve and analyze logs. For details, see Index Configuration.
If an existing log topic is selected, the index status will be consistent with the index status of the corresponding existing log topic by default.
5. After slow log shipping is successfully enabled, you can see that slow log shipping is enabled under Log Shipping. Click the log topic name to jump to the CLS console for subsequent analysis and management.


Disabling Slow Log Shipping

Note:
After slow log shipping is disabled, the generated slow log shipping data will be saved at the saving time selected when slow log shipping is enabled, and will be automatically cleared only after expiration.
1. Log in to the TencentDB for PostgreSQL console and click Instance ID in the instance list to go to the management page.
2. On the instance management page, select Performance Optimization > Log Shipping.
3. In Slow Query Log Shipping, click Disable Shipping.
4. In the pop-up window, select Disable and click Confirm.


Enabling Error Log Shipping

1. Log in to the TencentDB for PostgreSQL console and click Instance ID in the instance list to go to the management page.
2. On the instance management page, select Performance Optimization > Log Shipping.
3. In Error Log Shipping, click the Enable Now button.
4. Complete the following configuration in the pop-up window, and click Enable Now.

Parameter
Description
Destination region
Select the region for log shipping, supporting offsite shipping.
Logset Operation
A logset categorizes log topics to facilitate your management of log topics. You can select an existing logset or create a logset.
Logset
Select an existing logset: You can filter existing logsets in the search box to categorize error log shipping.
Create a logset: You can create a new logset to categorize error log shipping. The naming format for creating a logset is custom_logset, where the custom part supports only English letters, digits, and underscores, with a length not exceeding 20.
Log Topic
Select an existing log topic: This option is available only when an existing logset is selected. You can filter log topics under the selected logset in the search box.
Create a log topic: You can create a new log topic under the selected logset. The naming format for creating a log topic is custom_topic, where the custom part supports only English letters, digits, and underscores, with a length not exceeding 20.
Note:
You can manage log topics. For details, see Managing Log Topics.
Note:
It is enabled by default. Index configuration is a necessary condition to use CLS for retrieval and analysis. Only by enabling the indexing feature can you retrieve and analyze logs. For details, see Index Configuration.
If an existing log topic is selected, the index status will be consistent with the index status of the corresponding existing log topic by default.
5. After error log shipping is successfully enabled, you can see that error log shipping is enabled under Log Shipping. Click the log topic name to jump to the CLS console for subsequent analysis and management.


Disabling Error Log Shipping

Note:
After error log shipping is disabled, the generated error log shipping data will be saved at the saving time selected when error log shipping is enabled, and will be automatically cleared only after expiration.
1. Log in to the TencentDB for PostgreSQL console and click Instance ID in the instance list to go to the management page.
2. On the instance management page, select Performance Optimization > Log Shipping.
3. In Error Log Shipping, click Disable Shipping.
4. In the pop-up window, select Disable and click Confirm.

Documentation

Logset
Dashboard
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback