Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Logging Destination

Updated on 2024-05-07 GMT+08:00

log_destination

Parameter description: GaussDB supports several methods of logging server messages. Set this parameter to a list of desired log destinations separated by commas. (For example, log_destination="stderr,csvlog")

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Value range: a string.

The valid values are stderr, csvlog, and syslog.

  • stderr indicates that logs are printed to the screen.
  • csvlog indicates that logs are output in comma-separated value (CSV) format. The prerequisite for generating logs in CSV format is that logging_collector must be set to on. For details, see Using CSV Log Output.
  • syslog indicates that logs are recorded using the syslog of the OS. GaussDB can record logs using syslog from LOCAL0 to LOCAL7. For details, see syslog_facility. To record logs using syslog, add the following information to syslog daemon's configuration file:
    1
    local0.*  /var/log/postgresql
    

Default value: stderr

logging_collector

Parameter description: Specifies whether to enable the logger process to collect logs. This process captures log messages sent to stderr or csvlog and redirects them into log files.

This method is more effective than recording logs to syslog because some types of messages cannot be displayed in syslog output, such as messages indicating the loading failures of dynamic link libraries and error messages generated by scripts (for example, archive_command).

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

NOTICE:

It is possible to log to stderr without using the logging collector and the log messages will go to where the server's stderr is directed. However, this method is only suitable for low log volumes due to difficulties in rotating log files.

Value range: Boolean

  • on indicates that the log collection is enabled.
  • off indicates that the log collection is disabled.

Default value: on

log_directory

Parameter description: Specifies the directory for storing log files when logging_collector is set to on. The value can be an absolute path, or relative to the data directory. The log_directory parameter can be dynamically modified using the gs_guc reload command. Only the sysadmin user can access this parameter.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.

NOTICE:
  • If this parameter is set to an invalid path, the cluster cannot be started.
  • If you modify the log_directory parameter using the gs_guc reload command, and the specified path is valid, the log files are output to this new path. If the specified path is invalid, the log files are output to the valid path set last time and the database operation is not affected. The invalid value is still written into the configuration file.
  • In the sandbox environment, the path cannot contain /var/chroot. For example, if the absolute path of log is /var/chroot/var/lib/log/Ruby/pg_log/cn_log, you only need to set the path to /var/lib/log/Ruby/pg_log/cn_log.
NOTE:
  • Valid path: Users have read and write permissions on the path.
  • Invalid path: Users do not have read or write permissions on an invalid path.

Value range: a string

Default value: specified during installation

log_filename

Parameter description: Specifies the names of generated log files when logging_collector is set to on. The value is treated as a strftime pattern, so %-escapes can be used to specify time-varying file names. Only the sysadmin user can access this parameter.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.

NOTICE:
  • You are advised to use %-escapes to specify the log file names for efficient management of log files.
  • If log_destination is set to csvlog, log files are output in CSV format with timestamped names, for example, server_log.1093827753.csv.

Value range: a string

Default value: postgresql-%Y-%m-%d_%H%M%S.log

log_file_mode

Parameter description: Specifies the permissions of log files when logging_collector is set to on. This parameter is invalid on Windows. The parameter value is usually a number in the format acceptable to the chmod and umask system calls.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.

NOTICE:
  • Before setting this parameter, set log_directory to store the logs to a directory other than the data directory.
  • Do not make the log files world-readable because they might contain sensitive data.

Value range: an octal integer ranging from 0000 to 0777 (that is, 0 to 511 in the decimal format)

NOTE:
  • 0600 indicates that log files are readable and writable only to the server administrator.
  • 0640 indicates that log files are readable and writable to members of the administrator's group.

Default value: 0600

log_truncate_on_rotation

Parameter description: Specifies the writing mode of the log files when logging_collector is set to on.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.

A setting example is as follows:

Assume that you want logs to be kept for 7 days, a log file generated each day to be named server_log.Mon on Monday, server_log.Tue on Tuesday, and so forth, and this week's log files to be overwritten by next week's log files. Then you can set log_filename to server_log.%a, log_truncate_on_rotation to on, and log_rotation_age to 1440 (indicating that the valid duration of the log file is 24 hours).

Value range: Boolean

  • on indicates that GaussDB overwrites the existing log files of the same name on the server.
  • off indicates that GaussDB appends the logging messages to the existing log files of the same name on the server.

Default value: off

log_rotation_age

Parameter description: Specifies the interval for creating a log file when logging_collector is set to on. If the duration from the time when the last log file was created to the current time is greater than the value of log_rotation_age, a new log file will be generated.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from 0 to 35791394. The unit is min. 0 indicates that the time-based creation of new log files is disabled.

Default value: 1d (1440 min)

log_rotation_size

Parameter description: Specifies the maximum size of a server log file when logging_collector is set to on. If the total size of messages in a log file exceeds the specified value, a log file will be generated.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from 0 to 2097151. The unit is KB.

0 indicates that the capacity-based creation of new log files is disabled.

Default value: 20 MB

syslog_facility

Parameter description: Specifies the syslog facility to be used when log_destination is set to syslog.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Value range: enumerated values. Valid values are local0, local1, local2, local3, local4, local5, local6, and local7.

Default value: local0

syslog_ident

Parameter description: Specifies the identifier of GaussDB messages in syslog logs when log_destination is set to syslog.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Value range: a string

Default value: postgres

event_source

Parameter description: Specifies the identifier of GaussDB messages in logs when log_destination is set to eventlog.

This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Value range: a string

Default value: PostgreSQL

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback