Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 17DC4B5DC38 for ; Fri, 5 Aug 2011 19:18:28 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 08456-04 for ; Fri, 5 Aug 2011 22:18:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail149055.authsmtp.co.uk (outmail149055.authsmtp.co.uk [62.13.149.55]) by mail.postgresql.org (Postfix) with ESMTP id 2F1E4B5D8C5 for ; Fri, 5 Aug 2011 19:18:20 -0300 (ADT) Received: from mail-c193.authsmtp.com (mail-c193.authsmtp.com [62.13.128.118]) by punt9.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id p75MIHhd061945; Fri, 5 Aug 2011 23:18:17 +0100 (BST) Received: from tornado.leadboat.com (adsl-98-69-163-199.rmo.bellsouth.net [98.69.163.199]) (authenticated bits=128) by mail.authsmtp.com (8.14.2/8.14.2) with ESMTP id p75MICKc090474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 5 Aug 2011 23:18:15 +0100 (BST) Date: Fri, 5 Aug 2011 18:18:12 -0400 From: Noah Misch To: pgsql-bugs@postgresql.org Cc: Marc Cousin Subject: Re: BUG #5741: syslog line length Message-ID: <20110805221811.GC419@tornado.leadboat.com> References: <201011021617.oA2GH8L6089397@wwwmaster.postgresql.org> <4DF22887.6020701@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DF22887.6020701@gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Server-Quench: d10b5e47-bfb0-11e0-97bb-002264978518 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZTSw0a InkCABZdQAk/LxtQ RxQEKB1fPV4VVBxV PwYAb0wLbRo1WF4e AWYKWkRWU1dwUWl0 bURYZRtba1RPWQZ0 UUFAXVBXFgB3AFJB ARtjK2oJJAVPeHp3 YQhqXHFaEhB7dRR4 F0pTCD9QN2d9aWFK UF1RcFEGbQNKfB1D bll4XHYMaStlM3Bw NTIcd3tsYmkGemxO UxoJKl1aRUcNE3Y4 ShYNATVH X-Authentic-SMTP: 61633235383639.1014:706 X-AuthFastPath: 0 (Was 255) X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201108/53 X-Sequence-Number: 30865 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=6b7eebc05e3bfd86757f5aa1f05bca463e92d7db 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