tencent cloud

All product documents
TencentDB for PostgreSQL
Log Shipping
Last updated: 2025-02-07 16:43:40
Log Shipping
Last updated: 2025-02-07 16:43:40
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, make sure you have activated CLS.

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. Under Slow Query 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 log topic or create a log topic.
Logset
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 operations
A log topic is the basic unit for log data collection, storage, retrieval, and analysis. You can select an existing log topic or create a log topic.
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:
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. Under 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. Under 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. Under 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

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon