/var/log/postgresql.log
cat /var/log/postgres.log | pgbadger -
# Log prefix with stderr log output
- perl pgbadger --prefix '%t [%p]: [%l-1] user=%u,db=%d,client=%h'
+ perl pgbadger --prefix '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h'
/pglog/postgresql-2012-08-21*
perl pgbadger --prefix '%m %u@%d %p %r %a : ' /pglog/postgresql.log
# Log line prefix with syslog log output
- perl pgbadger --prefix 'user=%u,db=%d,client=%h,appname=%a'
+ perl pgbadger --prefix 'user=%u,db=%d,client=%h,app=%a'
/pglog/postgresql-2012-08-21*
# Use my 8 CPUs to parse my 10GB file faster, much faster
perl pgbadger -j 8 /pglog/postgresql-9.1-main.log
Histogram of query times.
Histogram of sessions times.
Users involved in top queries.
+ Applications involved in top queries.
Queries generating the most cancellation.
Queries most cancelled.
Here every statement will be logged, on busy server you may want to
increase this value to only log queries with a higher duration time.
Note that if you have log_statement set to 'all' nothing will be logged
- through log_min_duration_statement. See next chapter for more
+ through directive log_min_duration_statement. See next chapter for more
information.
With 'stderr' log format, log_line_prefix must be at least:
log_line_prefix = '%t [%p]: [%l-1] '
- Log line prefix could add user, database name and client ip address as
- follows:
+ Log line prefix could add user, database name, application name and
+ client ip address as follows:
- log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,client=%h '
+ log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h '
or for syslog log file format:
- log_line_prefix = 'user=%u,db=%d,client=%h '
+ log_line_prefix = 'user=%u,db=%d,app=%aclient=%h '
Log line prefix for stderr output could also be:
- log_line_prefix = '%t [%p]: [%l-1] db=%d,user=%u,client=%h '
+ log_line_prefix = '%t [%p]: [%l-1] db=%d,user=%u,app=%a,client=%h '
or for syslog output:
- log_line_prefix = 'db=%d,user=%u,client=%h '
+ log_line_prefix = 'db=%d,user=%u,app=%a,client=%h '
You need to enable other parameters in postgresql.conf to get more
information from your log files:
/var/log/postgresql.log
cat /var/log/postgres.log | pgbadger -
# Log prefix with stderr log output
- perl pgbadger --prefix '%t [%p]: [%l-1] user=%u,db=%d,client=%h'
+ perl pgbadger --prefix '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h'
/pglog/postgresql-2012-08-21*
perl pgbadger --prefix '%m %u@%d %p %r %a : ' /pglog/postgresql.log
# Log line prefix with syslog log output
- perl pgbadger --prefix 'user=%u,db=%d,client=%h,appname=%a'
+ perl pgbadger --prefix 'user=%u,db=%d,client=%h,app=%a'
/pglog/postgresql-2012-08-21*
# Use my 8 CPUs to parse my 10GB file faster, much faster
perl pgbadger -j 8 /pglog/postgresql-9.1-main.log
Histogram of query times.
Histogram of sessions times.
Users involved in top queries.
+ Applications involved in top queries.
Queries generating the most cancellation.
Queries most cancelled.
log_min_duration_statement = 0
Here every statement will be logged, on busy server you may want to increase
-this value to only log queries with a higher duration time. Note that if you have
-log_statement set to 'all' nothing will be logged through log_min_duration_statement.
-See next chapter for more information.
+this value to only log queries with a higher duration time. Note that if you
+have log_statement set to 'all' nothing will be logged through directive
+log_min_duration_statement. See next chapter for more information.
With 'stderr' log format, log_line_prefix must be at least:
log_line_prefix = '%t [%p]: [%l-1] '
-Log line prefix could add user, database name and client ip address as follows:
+Log line prefix could add user, database name, application name and client ip
+address as follows:
- log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,client=%h '
+ log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h '
or for syslog log file format:
- log_line_prefix = 'user=%u,db=%d,client=%h '
+ log_line_prefix = 'user=%u,db=%d,app=%aclient=%h '
Log line prefix for stderr output could also be:
- log_line_prefix = '%t [%p]: [%l-1] db=%d,user=%u,client=%h '
+ log_line_prefix = '%t [%p]: [%l-1] db=%d,user=%u,app=%a,client=%h '
or for syslog output:
- log_line_prefix = 'db=%d,user=%u,client=%h '
+ log_line_prefix = 'db=%d,user=%u,app=%a,client=%h '
You need to enable other parameters in postgresql.conf to get more information from your log files: