Tim Uckun wrote:
Is there a way to get pg_standby to put timestamps in the output it generates? I am currently piping the output to a log fie but since it contains no timestamps it's of limited use to me. Nope; already on my TODO list to take care of one day since it annoys me too. What you can do is run another program in parallel that does something similar to the "tail -f" behavior, letting you watch new files added to the log file. As each line is read, timestamps it and print the line. There's a sample that's almost what you want at http://stackoverflow.com/questions/441437/how-do-i-implement-tail-f-with-timeout-on-read-in-perl ; basically you'd just need to replace print "$item"; With
something like this:
printf "%s %s\n", strftime("%Y-%m-%d %H:%M:%S", localtime(time)), $item
(untested, and I am not a regular Perl
programmer, its but File::Tail is the best library I know of to do this
sort of thing)
-- Greg Smith 2ndQuadrant Baltimore, MD PostgreSQL Training, Services and Support greg@xxxxxxxxxxxxxxx www.2ndQuadrant.com |