Thread: WAL Archive Log
Is there a way to get postgres to write a line to the log file when it creates a WAL file? We wrote a script that tries to grab the times between WAL file creation and ingestion without stopping to make absolutely sure that postgres actually logs the WAL file creation, and so we're kinda stuck staring at our screens and blinking.
Seriously. It took me a good five minutes to muster the brain power to write this email.
-Sam
Excerpts from Sam Nelson's message of jue ago 26 19:24:00 -0400 2010: > Is there a way to get postgres to write a line to the log file when it > creates a WAL file? We wrote a script that tries to grab the times between > WAL file creation and ingestion without stopping to make absolutely sure > that postgres actually logs the WAL file creation, and so we're kinda stuck > staring at our screens and blinking. Not currently. WAL files are created well in advance of them being used, so perhaps there is no point, depending on what you want to do with the information. File recycling (which is the usual mechanism for them being created) is logged, sort of: it happens during checkpoint. -- Álvaro Herrera <alvherre@commandprompt.com> The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Alright, well, we'll probably do something with the archive command, then, like either echoing %f to a log file or sending that to syslog (and then, after the echo, doing the actual cp or scp or rsync or whatever). That way, we should be able to get some form of timestamp of when each WAL file is copied to the archive directory (using the archive_command), right?
Is there any way we could somehow get postgres to log a line for us, so that we get that line in the postgres log file? Or are we going to have to use a separate file?
Thanks much.
-Sam
On Thu, Aug 26, 2010 at 5:33 PM, Alvaro Herrera <alvherre@commandprompt.com> wrote:
Excerpts from Sam Nelson's message of jue ago 26 19:24:00 -0400 2010:> Is there a way to get postgres to write a line to the log file when itNot currently.
> creates a WAL file? We wrote a script that tries to grab the times between
> WAL file creation and ingestion without stopping to make absolutely sure
> that postgres actually logs the WAL file creation, and so we're kinda stuck
> staring at our screens and blinking.
WAL files are created well in advance of them being used, so perhaps
there is no point, depending on what you want to do with the
information.
File recycling (which is the usual mechanism for them being created) is
logged, sort of: it happens during checkpoint.
--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
On Fri, 2010-08-27 at 09:56 -0600, Sam Nelson wrote: > Alright, well, we'll probably do something with the archive command, > then, like either echoing %f to a log file or sending that to syslog > (and then, after the echo, doing the actual cp or scp or rsync or > whatever). That way, we should be able to get some form of timestamp > of when each WAL file is copied to the archive directory (using the > archive_command), right? > > > Is there any way we could somehow get postgres to log a line for us, > so that we get that line in the postgres log file? Or are we going to > have to use a separate file? Run this every N seconds to get the averaged write rate over the period SELECT pg_xlogfile_name(pg_current_xlog_location()); -- Simon Riggs www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Training and Services