tencent cloud

TencentDB for PostgreSQL

Release Notes and Announcements
Release Notes
Product Announcements
Product Introduction
Overview
Features
Strengths
Scenarios
Information Security
Regions and AZs
Product Feature List
Large version lifecycle description
MSSQL Compatible Version
Billing
Billing Overview
Instance Type and Specification
Purchase Methods
Refund
Overdue Payments
Backup Space Billing
Database Audit Billing Overview
Getting Started
Creating TencentDB for PostgreSQL Instance
Connecting to TencentDB for PostgreSQL Instance
Managing TencentDB for PostgreSQL Instance
Importing Data
Migrating Data with DTS
Kernel Version Introduction
Kernel Version Overview
Kernel Version Release Notes
Viewing Kernel Version
Proprietary Kernel Features
Database Audit
Audit Service Description
Activating Audit Service
View Audit Logs
Modify audit services
Audit Performance Description
User Guide
Instance Management
Upgrading Instance
CPU Elastic Scaling
Read-Only Instance
Account Management
Database Management
Parameter Management
Log Management and Analysis
Backup and Restoration
Data Migration
Extension Management
Network Management
Access Management
Data Security
Tenant and Resource Isolation
Security Groups
Monitoring and Alarms
Tag
AI Practice
Using the Tencentdb_ai Plug-In to Call Large Models
Building Ai Applications with the Tencentdb Ai Plug-In
Combining Supabase to Quickly Build Backend Service Based on TencentDB for PostgreSQL
Use Cases
postgres_fdw Extension for Cross-database Access
Automatically Creating Partition in PostgreSQL
Searching in High Numbers of Tags Based on pg_roaringbitmap
Querying People Nearby with One SQL Statement
Configuring TencentDB for PostgreSQL as GitLab's External Data Source
Supporting Tiered Storage Based on cos_fdw Extension
Implement Read/Write Separation via pgpool
Implementing Slow SQL Analysis Using the Auto_explain Plugin
Using pglogical for Logical Replication
Using Debezium to Collect PostgreSQL Data
Set Up a Remote Disaster Recovery Environment for PostgreSQL Locally on CVM
Read-Only Instance and Read-Only Group Practical Tutorial
How to Use SCF for Scheduled Database Operations
Fix Table Bloat
Performance White Paper
Test Methods
Test Results
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Read-Only Instance APIs
Backup and Recovery APIs
Parameter Management APIs
Security Group APIs
Performance Optimization APIs
Account APIs
Specification APIs
Network APIs
Data Types
Error Codes
FAQs
Service Agreement
Service Level Agreement
Terms of Service
Glossary
Contact Us

Execution Log Management

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2025-11-03 14:26:13
This document introduces how to manage the retention duration of pg_log.

Introduction to PG_LOG

pg_log typically records the status information of the database, such as error information, slow log SQL, database startup and shutdown information, etc. This log will be automatically segmented by size and time, and the pg_log of TencentDB for PostgreSQL is retained by default for 30 days. pg_log will occupy the storage space of the database instance, and you can modify the retention duration based on your needs.
Note:
The slow log and error log of the database instance are retained for 7 days by default. Modifying the pg_log retention duration does not affect the slow log and error log retention duration.

Modifying PG_LOG Retention Duration

You can modify the pg_log retention duration based on your needs. The system currently supports two options: 7 days and 30 days. The detailed steps are as follows:
2. Find the instance you need to modify in the instance list, click Operation > Manage to enter the instance details.
3. Find Parameter Settings in the Instance detail page, search for the parameter log_filename in the upper right corner and update it.

The introduction for the log_filename parameter is as follows:
Parameter Value
Description
postgresql_%a_%H.log
Selecting this value will keep logs for 7 days.
postgresql_%d_%H.log
Selecting this value allows logs to be retained for 30 days, which is the system default.
After modifying the log_filename parameter, you can set the number of retained running logs by modifying the tencentdb_max_logfile_num parameter to clean up historic log files. The system generates one log file per hour by default. Therefore, if the log_filename parameter is set to postgresql_%a_%H.log (7 days), set tencentdb_max_logfile_num to 168 or higher. If the log_filename parameter is set to postgresql_%d_%H.log (30 days), set tencentdb_max_logfile_num to 720 or higher. You can find the parameter setting on the instance details page by searching for tencentdb_max_logfile_num in the search box at the top right and updating it.

Note:
To retain sufficient running logs, set the tencentdb_max_logfile_num parameter to no less than 100.
The tencentdb_max_logfile_num parameter value 2147483647 means retain all.
If you cannot change the parameter tencentdb_max_logfile_num on the console, upgrade the minor kernel version.

Cleaning Extra Logs

For extra logs, you may execute the following statement after logging in to the instance to clean them immediately, or wait for the kernel to perform log rotation for auto cleanup.
SELECT pg_rotate_logfile();

Ajuda e Suporte

Esta página foi útil?

comentários