PostgreSQL Logs

PostgreSQL is one amongst the default log types supported by Site24x7 AppLogs, a cloud based log management solution. With Site24x7 you can easily find PostgreSQL data that has been separated into associated fields such as date & time, PID, message, host, log level, and user, all of which presented within a single web client.   Learn more about log management with Site24x7.

Getting started 

  1. Log in to your Site24x7 account.
  2. Download and install the Site24x7 Server Monitoring agent (Windows | Linux). 
  3. Go to Admin > AppLogs > Log Profile and Add Log Profile.

Logs File Path

Each application writes logs in different folders and files. By default, PostgreSQL logs are sourced from the below-mentioned folder path for the respective Operating System. If you have logs in a different folder, you can mention it under the File Path to source them from that particular folder while creating a log profile.

Linux icon
:
/var/log/postgresql/*
 
 
/var/lib/postgresql/*/main/pg_log/*
Windows icon
:
C:\postgresql*\*\pg_log\*
 
 
C:\Pr

Log Pattern

$DateTime:date$ [$PID$] [$User$]@[$Host$] $LogLevel$: $Message$

This is the default pattern defined by Site24x7 for parsing PostgreSQL logs based on the sample log mentioned below.

Sample Log

INFO [main] 2016-11-04 02:14:23,494 DatabaseDescriptor.java (line 143) Data files directories: [/home/local/ZOHOCORP/franklin-0532/Softwares/Cassandra/da

The above sample log can be separated into 6 fields, each of which will take its respective value from here and will then be uploaded to Site24x7.

Field name Field value
Date Time 2016-11-04 02:14:23
PID 494
User Data files directories:DatabaseDescriptor.java 
Host  /home/local/ZOHOCORP/franklin-0532/Softwares/Cassandra/da
Log Level  GET /test.txt HTTP/1.1
Message  200

Related log types

Was this document helpful?
Thanks for taking the time to share your feedback. We’ll use your feedback to improve our online help resources.