Re: timestams in the the pg_standby output

Поиск
Список
Период
Сортировка
От Greg Smith
Тема Re: timestams in the the pg_standby output
Дата
Msg-id 4B42D898.6090805@2ndquadrant.com
обсуждение исходный текст
Ответ на timestams in the the pg_standby output  (Tim Uckun <timuckun@gmail.com>)
Ответы Re: timestams in the the pg_standby output  (Tim Uckun <timuckun@gmail.com>)
Список pgsql-general
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@2ndQuadrant.com  www.2ndQuadrant.com

В списке pgsql-general по дате отправления:

Предыдущее
От: "Dann Corbit"
Дата:
Сообщение: Re: PostgreSQL Write Performance
Следующее
От: Tim Uckun
Дата:
Сообщение: Re: timestams in the the pg_standby output