Log

TOC

Introduction

PostgreSQL provides a robust logging system, including detailed error logs. Understanding these logs, which capture events during instance operation at the container level within your Kubernetes cluster, is crucial. Proper analysis of logs, especially error logs, helps you quickly identify the root cause of issues, troubleshoot effectively, and handle faults or exceptions promptly.

Procedure

CLI
Web Console
  1. View all related pods of the instance. Replace ${namespace} with the actual namespace and ${instance_name} with the instance name. Use the appropriate label selector for your PostgreSQL instance.
# Example using the standard Alauda label selector
kubectl get pod -n ${namespace} -l "middleware.instance/name=${instance_name}"
  1. Query the logs for a specific pod's postgres container. Replace ${namespace} and ${pod_name} with the actual values.
kubectl logs -n ${namespace} ${pod_name} -c postgres

Note: By default, PostgreSQL logs within the container are typically stored in the /var/log/pg_log directory, often as .log or .csv files. The exact path and format can be influenced by the PostgreSQL configuration.