Search Postgresql Archives

Re: timestams in the the pg_standby output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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";
   
print "\n" if ($line_no % DOTS_PER_LINE == 0);
    printf
"%s\n", strftime("%Y-%m-%d %H:%M:%S", localtime(time))
       
if ($line_no % (DOTS_PER_LINE * LINES_PER_BREAK) == 0);

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux