Thread: expanding on syslog help
Hi Guys, I just spent the last half hour learning syslog and log rolling with postgres. Would there be objections to me expanding on the syslog sections in the docs? http://developer.postgresql.org/docs/postgres/logfile-maintenance.html I want to: * Add a link to the third paragraph there where it says to set syslog to 2 that goes to the syslog section of the SET parameters page. * Give an example of how to configure your syslog.conf to log to a separate postgres log. eg: "Depending on your system, to have syslog log PostgreSQL entries to a particular file, add something like this to the top of your /etc/syslog.conf: # Log all 'postgres' events to /var/log/pgsql !postgres *.* /var/log/pgsql # Nothing after this line applies to 'postgres' !-postgres " * Mention that you might want to turn log_pid and log_timestamp off since syslog logs them anyway * Mention something about system log rotator? Or is that too platform-specific? Chris
Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes: > Would there be objections to me expanding on the syslog > sections in the docs? No, but ... > # Log all 'postgres' events to /var/log/pgsql > !postgres > *.* /var/log/pgsql > # Nothing after this line applies to 'postgres' > !-postgres > " This example seems not portable in the least; AFAICT neither syntax that you show is accepted by HPUX's syslogd, for example. > * Mention that you might want to turn log_pid and log_timestamp off > since syslog logs them anyway Check. > * Mention something about system log rotator? Or is that too > platform-specific? I think it's reasonable to suggest that syslogd might not solve the problem all by itself. Dunno if we can give better advice than "read your local syslogd man page". regards, tom lane
Christopher Kings-Lynne wrote: > *.* /var/log/pgsql With linux is better do: *.* -/var/log/pgsql the "-" instruct syslog to not flush on the disk each line received. BTW in general your instructions are platform dependend Regards Gaetano Mendola
--On Tuesday, September 30, 2003 13:44:04 +0800 Christopher Kings-Lynne <chriskl@familyhealth.com.au> wrote: > Hi Guys, > [snip] > > * Mention something about system log rotator? Or is that too > platform-specific? newsyslog (FreeBSD base, http://www.courtesan.com/ (Portable) ) is useful. newsyslog may be in the other *BSD's as well. LER > > Chris > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
--On Tuesday, September 30, 2003 13:44:04 +0800 Christopher Kings-Lynne <chriskl@familyhealth.com.au> wrote: > Hi Guys, > > I just spent the last half hour learning syslog and log rolling with > postgres. Would there be objections to me expanding on the syslog > sections in the docs? > > http://developer.postgresql.org/docs/postgres/logfile-maintenance.html > > I want to: > > * Add a link to the third paragraph there where it says to set syslog to > 2 that goes to the syslog section of the SET parameters page. > > * Give an example of how to configure your syslog.conf to log to a > separate postgres log. eg: > > "Depending on your system, to have syslog log PostgreSQL entries to a > particular file, add something like this to the top of your > /etc/syslog.conf: > ># Log all 'postgres' events to /var/log/pgsql > !postgres > *.* /var/log/pgsql ># Nothing after this line applies to 'postgres' > !-postgres > " a more standard (non-FreeBSD specific) answer is: local0.* /var/log/postgres.log (this also works on FreeBSD, btw). -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
On Tue, 2003-09-30 at 01:44, Christopher Kings-Lynne wrote: > * Mention that you might want to turn log_pid and log_timestamp off > since syslog logs them anyway > i think that debug_pretty_print is somewhat pointless too, as syslog tends to wrap lines automagically... could be others. > * Mention something about system log rotator? Or is that too > platform-specific? > "The simplest production-grade approach to managing log output is to send it all to syslog and let syslog deal with file rotation. To do this, set the configurations parameter syslog to 2 (to log to syslog only) in postgresql.conf. Then you can send a SIGHUP signal to the syslog daemon whenever you want to force it to start writing a new log file. " Perhaps add: "If you want to automate the log rotation, the logrotate program can be configured to work with log files from syslog." at least, on most linux distros (and I'm just guessing others) this is how they come configured. Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
Robert Treat wrote: > On Tue, 2003-09-30 at 01:44, Christopher Kings-Lynne wrote: > > * Mention that you might want to turn log_pid and log_timestamp off > > since syslog logs them anyway > > > > i think that debug_pretty_print is somewhat pointless too, as syslog > tends to wrap lines automagically... could be others. > > > * Mention something about system log rotator? Or is that too > > platform-specific? > > > > "The simplest production-grade approach to managing log output is to > send it all to syslog and let syslog deal with file rotation. To do > this, set the configurations parameter syslog to 2 (to log to syslog > only) in postgresql.conf. Then you can send a SIGHUP signal to the > syslog daemon whenever you want to force it to start writing a new log > file. " > > Perhaps add: > "If you want to automate the log rotation, the logrotate program can be > configured to work with log files from syslog." > > at least, on most linux distros (and I'm just guessing others) this is > how they come configured. Added. Thanks. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073