PostgreSQL Logs

PostgreSQL is one amongst the default log types supported by OpManager Nexus AppLogs, a cloud based log management solution. With OpManager Nexus 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 OpManager Nexus.

Getting started

  1. Log in to your OpManager Nexus account.
  2. Download and install the OpManager Nexus 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 OpManager Nexus 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 OpManager Nexus.

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
Shortlink has been copied!