Re: PG levels vs. syslog levels

Lists: pgsql-general
From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: PG levels vs. syslog levels
Date: 2007-09-20 20:03:46
Message-ID: 46F2D222.4030808@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

What is the correlation between PostgreSQL log severity levels and
syslog levels?

Specifically, I have PG (8.1) configured to route messages to syslog and
want to configure syslog to give me a periodic report of all error/worse
events. I configured syslog (syslog-ng) to create hourly files of
error/worse from the PG log data (local2 for me) and generated some
client errors ("select 1 from nonexistent_table;")

As expected, my log shows:
...[23084]: [13-1] ERROR: relation "nonexistent_table" does not exist
...[23084]: [13-2] STATEMENT: select 1 from nonexistent_table;

But my special error log does not. After some testing I have determined
that syslog is seeing this as level "warning".

Thoughts/suggestions?

Cheers,
Steve


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: PG levels vs. syslog levels
Date: 2007-09-20 22:00:52
Message-ID: 15438.1190325652@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Steve Crawford <scrawford(at)pinpointresearch(dot)com> writes:
> What is the correlation between PostgreSQL log severity levels and
> syslog levels?

Hmm, doesn't seem to be documented anywhere, but a look into the source
code finds

switch (edata->elevel)
{
case DEBUG5:
case DEBUG4:
case DEBUG3:
case DEBUG2:
case DEBUG1:
syslog_level = LOG_DEBUG;
break;
case LOG:
case COMMERROR:
case INFO:
syslog_level = LOG_INFO;
break;
case NOTICE:
case WARNING:
syslog_level = LOG_NOTICE;
break;
case ERROR:
syslog_level = LOG_WARNING;
break;
case FATAL:
syslog_level = LOG_ERR;
break;
case PANIC:
default:
syslog_level = LOG_CRIT;
break;
}

regards, tom lane