pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5741: syslog line length
9+ messages / 6 participants
[nested] [flat]

* BUG #5741: syslog line length
@ 2010-11-02 16:17 heasley <heas@shrubbery.net>
  2011-06-10 14:21 ` Re: BUG #5741: syslog line length Marc Cousin <cousinmarc@gmail.com>
  2011-06-29 17:49 ` Re: BUG #5741: syslog line length Robert Haas <robertmhaas@gmail.com>
  0 siblings, 2 replies; 9+ messages in thread

From: heasley @ 2010-11-02 16:17 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      5741
Logged by:          heasley
Email address:      heas@shrubbery.net
PostgreSQL version: 8.4
Operating system:   solaris
Description:        syslog line length
Details: 

* Max string length to send to syslog().  Note that this doesn't count the
 * sequence-number prefix we add, and of course it doesn't count the prefix
 * added by syslog itself.      On many implementations it seems that the
hard
 * limit is approximately 2K bytes including both those prefixes.
 */
#ifndef PG_SYSLOG_LIMIT
#define PG_SYSLOG_LIMIT 1024
#endif

solaris' syslogd limits the line length to 1024, with a
FQDN and it's silly "msg ID" quite a bit is dropped by
syslogd.



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: BUG #5741: syslog line length
  2010-11-02 16:17 BUG #5741: syslog line length heasley <heas@shrubbery.net>
@ 2011-06-10 14:21 ` Marc Cousin <cousinmarc@gmail.com>
  2011-08-05 22:18   ` Re: BUG #5741: syslog line length Noah Misch <noah@2ndQuadrant.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Marc Cousin @ 2011-06-10 14:21 UTC (permalink / raw)
  To: pgsql-bugs

On 02/11/2010 17:17, heasley wrote:
> The following bug has been logged online:
>
> Bug reference:      5741
> Logged by:          heasley
> Email address:      heas@shrubbery.net
> PostgreSQL version: 8.4
> Operating system:   solaris
> Description:        syslog line length
> Details: 
>
> * Max string length to send to syslog().  Note that this doesn't count the
>  * sequence-number prefix we add, and of course it doesn't count the prefix
>  * added by syslog itself.      On many implementations it seems that the
> hard
>  * limit is approximately 2K bytes including both those prefixes.
>  */
> #ifndef PG_SYSLOG_LIMIT
> #define PG_SYSLOG_LIMIT 1024
> #endif
>
> solaris' syslogd limits the line length to 1024, with a
> FQDN and it's silly "msg ID" quite a bit is dropped by
> syslogd.
>
I've been having the exact same problem with CentOS 5.5 these days (and
a customer's Red Hat 5.4).

This same problem occurs with sysklogd, which has a
#define MAXLINE         1024            /* maximum line length */

Replacing sysklogd with rsyslog, metalog or syslog-ng solves the
problem, as they all have 2048 for their buffer size.

But CentOS and RedHat 5 both seem to have sysklogd as the default logger.

I'll solve this by changing their logger, but I thought it would be
worthy to mention.



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: BUG #5741: syslog line length
  2010-11-02 16:17 BUG #5741: syslog line length heasley <heas@shrubbery.net>
  2011-06-10 14:21 ` Re: BUG #5741: syslog line length Marc Cousin <cousinmarc@gmail.com>
@ 2011-08-05 22:18   ` Noah Misch <noah@2ndQuadrant.com>
  2011-08-05 22:46     ` Re: BUG #5741: syslog line length Tom Lane <tgl@sss.pgh.pa.us>
  2012-01-04 20:45     ` Re: BUG #5741: syslog line length Guillaume Smet <guillaume.smet@gmail.com>
  0 siblings, 2 replies; 9+ messages in thread

From: Noah Misch @ 2011-08-05 22:18 UTC (permalink / raw)
  To: pgsql-bugs; +Cc: Marc Cousin <cousinmarc@gmail.com>

On Fri, Jun 10, 2011 at 04:21:59PM +0200, Marc Cousin wrote:
> On 02/11/2010 17:17, heasley wrote:
> > The following bug has been logged online:
> >
> > Bug reference:      5741
> > Logged by:          heasley
> > Email address:      heas@shrubbery.net
> > PostgreSQL version: 8.4
> > Operating system:   solaris
> > Description:        syslog line length
> > Details: 
> >
> > * Max string length to send to syslog().  Note that this doesn't count the
> >  * sequence-number prefix we add, and of course it doesn't count the prefix
> >  * added by syslog itself.      On many implementations it seems that the
> > hard
> >  * limit is approximately 2K bytes including both those prefixes.
> >  */
> > #ifndef PG_SYSLOG_LIMIT
> > #define PG_SYSLOG_LIMIT 1024
> > #endif
> >
> > solaris' syslogd limits the line length to 1024, with a
> > FQDN and it's silly "msg ID" quite a bit is dropped by
> > syslogd.
> >
> I've been having the exact same problem with CentOS 5.5 these days (and
> a customer's Red Hat 5.4).
> 
> This same problem occurs with sysklogd, which has a
> #define MAXLINE         1024            /* maximum line length */

A PG_SYSLOG_LIMIT value that loses data to truncation on nearly every default
GNU/Linux installation makes for a poor default.  It seems we raised it from 128
to 1024 for version 8.4, on performance grounds:
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=6b7eebc05e3bfd86757f5aa1f05bca463e92d7...

How about 896?  I reach that figure based on 1024 as a reasonable limit for the
total syslog line, including prefix, and these estimates for the prefix parts:

25 - fixed-length content
16 - syslog_ident [default is "postgres"]
10 - pid
32 - hostname [certainly not a limit, but frequently adequate]
10 - sequence number [ditto]
 3 - chunk number [ditto]
32 - facility/priority/message ID added by some syslog implementations
= 128

Perhaps, though, the default should be outright conservative, like 512.  We
could also have a compile-time fixed overhead and factor in actual lengths of
parts we know at runtime, but that smells like overkill.  Opinions?

-- 
Noah Misch                    http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: BUG #5741: syslog line length
  2010-11-02 16:17 BUG #5741: syslog line length heasley <heas@shrubbery.net>
  2011-06-10 14:21 ` Re: BUG #5741: syslog line length Marc Cousin <cousinmarc@gmail.com>
  2011-08-05 22:18   ` Re: BUG #5741: syslog line length Noah Misch <noah@2ndQuadrant.com>
@ 2011-08-05 22:46     ` Tom Lane <tgl@sss.pgh.pa.us>
  2011-08-05 23:18       ` Re: BUG #5741: syslog line length Noah Misch <noah@2ndQuadrant.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Tom Lane @ 2011-08-05 22:46 UTC (permalink / raw)
  To: Noah Misch <noah@2ndQuadrant.com>; +Cc: pgsql-bugs; Marc Cousin <cousinmarc@gmail.com>

Noah Misch <noah@2ndQuadrant.com> writes:
> A PG_SYSLOG_LIMIT value that loses data to truncation on nearly every default
> GNU/Linux installation makes for a poor default.

When I changed it, it was on the strength of tests showing that Fedora
8's default syslogger had a limit of 2KB.  A quick check shows this is
still the case in Fedora 15.  So I'm not convinced that "nearly every"
is anywhere near true.

> How about 896?

But having said that, I could go with 896 (or perhaps 900, which seems
a shade less weird).

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: BUG #5741: syslog line length
  2010-11-02 16:17 BUG #5741: syslog line length heasley <heas@shrubbery.net>
  2011-06-10 14:21 ` Re: BUG #5741: syslog line length Marc Cousin <cousinmarc@gmail.com>
  2011-08-05 22:18   ` Re: BUG #5741: syslog line length Noah Misch <noah@2ndQuadrant.com>
  2011-08-05 22:46     ` Re: BUG #5741: syslog line length Tom Lane <tgl@sss.pgh.pa.us>
@ 2011-08-05 23:18       ` Noah Misch <noah@2ndQuadrant.com>
  2011-08-06 01:03         ` Re: BUG #5741: syslog line length Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Noah Misch @ 2011-08-05 23:18 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs; Marc Cousin <cousinmarc@gmail.com>

On Fri, Aug 05, 2011 at 06:46:21PM -0400, Tom Lane wrote:
> Noah Misch <noah@2ndQuadrant.com> writes:
> > A PG_SYSLOG_LIMIT value that loses data to truncation on nearly every default
> > GNU/Linux installation makes for a poor default.
> 
> When I changed it, it was on the strength of tests showing that Fedora
> 8's default syslogger had a limit of 2KB.  A quick check shows this is
> still the case in Fedora 15.  So I'm not convinced that "nearly every"
> is anywhere near true.

Point taken.  Marc hit the 1024 limit in RHEL 5, which appears to be based on
Fedora 6.  Perhaps Fedora began to patch in the higher limit in 7 or 8.  I also
observed the 1024 limit in Ubuntu 8.04 LTS.  It is the limit in the latest
source distributions of sysklogd, too.

> > How about 896?
> 
> But having said that, I could go with 896 (or perhaps 900, which seems
> a shade less weird).

That works for me.

-- 
Noah Misch                    http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachments:

syslog-limit-900.patch (text/plain, 1007B) download *** a/src/backend/utils/error/elog.c --- b/src/backend/utils/error/elog.c *************** *** 105,115 **** int Log_destination = LOG_DESTINATION_STDERR; /* * Max string length to send to syslog(). Note that this doesn't count the * sequence-number prefix we add, and of course it doesn't count the prefix ! * added by syslog itself. On many implementations it seems that the hard ! * limit is approximately 2K bytes including both those prefixes. */ #ifndef PG_SYSLOG_LIMIT ! #define PG_SYSLOG_LIMIT 1024 #endif static bool openlog_done = false; --- 105,115 ---- /* * Max string length to send to syslog(). Note that this doesn't count the * sequence-number prefix we add, and of course it doesn't count the prefix ! * added by syslog itself. Solaris and sysklogd truncate the final message at ! * 1024 bytes, so this value leaves 124 bytes for those prefixes. */ #ifndef PG_SYSLOG_LIMIT ! #define PG_SYSLOG_LIMIT 900 #endif static bool openlog_done = false;
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: BUG #5741: syslog line length
  2010-11-02 16:17 BUG #5741: syslog line length heasley <heas@shrubbery.net>
  2011-06-10 14:21 ` Re: BUG #5741: syslog line length Marc Cousin <cousinmarc@gmail.com>
  2011-08-05 22:18   ` Re: BUG #5741: syslog line length Noah Misch <noah@2ndQuadrant.com>
  2011-08-05 22:46     ` Re: BUG #5741: syslog line length Tom Lane <tgl@sss.pgh.pa.us>
  2011-08-05 23:18       ` Re: BUG #5741: syslog line length Noah Misch <noah@2ndQuadrant.com>
@ 2011-08-06 01:03         ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 9+ messages in thread

From: Tom Lane @ 2011-08-06 01:03 UTC (permalink / raw)
  To: Noah Misch <noah@2ndQuadrant.com>; +Cc: pgsql-bugs; Marc Cousin <cousinmarc@gmail.com>

Noah Misch <noah@2ndQuadrant.com> writes:
> On Fri, Aug 05, 2011 at 06:46:21PM -0400, Tom Lane wrote:
>> But having said that, I could go with 896 (or perhaps 900, which seems
>> a shade less weird).

> That works for me.

OK, applied to HEAD and 9.1.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: BUG #5741: syslog line length
  2010-11-02 16:17 BUG #5741: syslog line length heasley <heas@shrubbery.net>
  2011-06-10 14:21 ` Re: BUG #5741: syslog line length Marc Cousin <cousinmarc@gmail.com>
  2011-08-05 22:18   ` Re: BUG #5741: syslog line length Noah Misch <noah@2ndQuadrant.com>
@ 2012-01-04 20:45     ` Guillaume Smet <guillaume.smet@gmail.com>
  1 sibling, 0 replies; 9+ messages in thread

From: Guillaume Smet @ 2012-01-04 20:45 UTC (permalink / raw)
  To: pgsql-bugs; Tom Lane <tgl@sss.pgh.pa.us>

Hi,

On Sat, Aug 6, 2011 at 12:18 AM, Noah Misch <noah@2ndquadrant.com> wrote:
> A PG_SYSLOG_LIMIT value that loses data to truncation on nearly every default
> GNU/Linux installation makes for a poor default.

On Sat, Aug 6, 2011 at 3:03 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> OK, applied to HEAD and 9.1.

We hit this problem a few days ago on a server with RHEL 5 +
PostgreSQL 8.4 + syslog. It made it quite difficult to work on the
slow queries paralyzing the server as several of them had truncated
lines in the middle of them.

Any chance to have this fix backported to 8.4 and 9.0 as this is a
regression introduced in 8.4?

Thanks for your feedback.

-- 
Guillaume



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: BUG #5741: syslog line length
  2010-11-02 16:17 BUG #5741: syslog line length heasley <heas@shrubbery.net>
@ 2011-06-29 17:49 ` Robert Haas <robertmhaas@gmail.com>
  2011-06-30 06:19   ` Re: BUG #5741: syslog line length heasley <heas@shrubbery.net>
  1 sibling, 1 reply; 9+ messages in thread

From: Robert Haas @ 2011-06-29 17:49 UTC (permalink / raw)
  To: heasley <heas@shrubbery.net>; +Cc: pgsql-bugs

On Tue, Nov 2, 2010 at 12:17 PM, heasley <heas@shrubbery.net> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      5741
> Logged by:          heasley
> Email address:      heas@shrubbery.net
> PostgreSQL version: 8.4
> Operating system:   solaris
> Description:        syslog line length
> Details:
>
> * Max string length to send to syslog().  Note that this doesn't count the
>  * sequence-number prefix we add, and of course it doesn't count the prefix
>  * added by syslog itself.      On many implementations it seems that the
> hard
>  * limit is approximately 2K bytes including both those prefixes.
>  */
> #ifndef PG_SYSLOG_LIMIT
> #define PG_SYSLOG_LIMIT 1024
> #endif
>
> solaris' syslogd limits the line length to 1024, with a
> FQDN and it's silly "msg ID" quite a bit is dropped by
> syslogd.

You can recompile with -DPG_SYSLOG_LIMIT=<some smaller value>.

We could add a configuration setting for this, if it's affecting a lot
of people.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: BUG #5741: syslog line length
  2010-11-02 16:17 BUG #5741: syslog line length heasley <heas@shrubbery.net>
  2011-06-29 17:49 ` Re: BUG #5741: syslog line length Robert Haas <robertmhaas@gmail.com>
@ 2011-06-30 06:19   ` heasley <heas@shrubbery.net>
  0 siblings, 0 replies; 9+ messages in thread

From: heasley @ 2011-06-30 06:19 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: pgsql-bugs

Wed, Jun 29, 2011 at 01:49:05PM -0400, Robert Haas:
> You can recompile with -DPG_SYSLOG_LIMIT=<some smaller value>.
> 
> We could add a configuration setting for this, if it's affecting a lot
> of people.

that'd be useful.  we have recently decided to abandon oracle's lovely support
{de-}structure; so i've lost interest.  but, thanks for the suggested
work-around.



^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2012-01-04 20:45 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02 16:17 BUG #5741: syslog line length heasley <heas@shrubbery.net>
2011-06-10 14:21 ` Marc Cousin <cousinmarc@gmail.com>
2011-08-05 22:18   ` Noah Misch <noah@2ndQuadrant.com>
2011-08-05 22:46     ` Tom Lane <tgl@sss.pgh.pa.us>
2011-08-05 23:18       ` Noah Misch <noah@2ndQuadrant.com>
2011-08-06 01:03         ` Tom Lane <tgl@sss.pgh.pa.us>
2012-01-04 20:45     ` Guillaume Smet <guillaume.smet@gmail.com>
2011-06-29 17:49 ` Robert Haas <robertmhaas@gmail.com>
2011-06-30 06:19   ` heasley <heas@shrubbery.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox