Extension to monitor errors in log

Поиск
Список
Период
Сортировка
От Святослав Ермилин
Тема Extension to monitor errors in log
Дата
Msg-id 43731587553233@mail.yandex-team.ru
обсуждение исходный текст
Список pgsql-hackers
Hi!
I wrote extension for postgresql that is collecting statistics about errors in logfile.

This extension counts the number of messages of each type and code.
It's designed to enable monitoring tools. I'm going to use it as a data source for plot of number of errors, warnings
andfatals.
 
Source code is here: https://github.com/munakoiso/logerrors

Design considerations.
There is a hash table in shared memory that contains counters of each type (currently only fatal, error, warning) and
everypossible error code. 
 
In emit_log_hook messages are updating this info in hash table. Then bgworker every n seconds collects and prepares
thisinfo.
 
pg_log_errors_stats() function is using this table in shared memory can show stats at last n*k seconds.

Here is an example of usage:
postgres=# select * from pg_log_errors_stats();
     time_interval |  type   |       message        | count
    ---------------+---------+----------------------+-------
                   | WARNING | TOTAL                |     0
                   | ERROR   | TOTAL                |     3
               600 | ERROR   | ERRCODE_SYNTAX_ERROR |     3
                 5 | ERROR   | ERRCODE_SYNTAX_ERROR |     2
                   | FATAL   | TOTAL                |     0

It would be very cool if someone gave me some feedback.

-- 
Sviatoslav Ermilin
Yandex



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

Предыдущее
От: Ahsan Hadi
Дата:
Сообщение: Re: create partition table caused server crashed withself-referencing foreign key
Следующее
От: Dipesh Pandit
Дата:
Сообщение: Re: WIP/PoC for parallel backup