LINUX.ORG.RU
ФорумAdmin

PostgeSQL - отключить логирование

 , ,


0

1

Приветствую,

Сразу укажу что я не спец в postgresql, форумы/выдачу google перелопатил - не нашел решения, поэтому спрашиваю здесь.

Опишу суть проблемы - в лог востгреса пишутся строки типа

2017-10-03 11:45:12 UTC [10138]: [2-1] user=dbuser,db=database DETAIL:  parameters: $1 = '0ab88bdf-52b5-4996-9adc-671a2368f8b8', $2 = '2017-10-03'

Таких строк очень много и они часто бывают ооочень большими, что в свою очередь приводит к частому переполнению лога.

Так вот, я пытаюсь отключить вывод в лог строк такого типа, но они «лезут и лезут» (с)

Отключал командой:

set log_error_verbosity to 'TERSE';

Потом делал:

select pg_reload_conf();

Но безрезультатно. Куда еще можно посмотреть?

Постарался поотключать также все что относится к логгированию:

           name             |            setting             |                                    short_desc                                    
-----------------------------+--------------------------------+----------------------------------------------------------------------------------
 application_name            | psql                           | Sets the application name to be reported in statistics and logs.
 client_min_messages         | error                          | Sets the message levels that are sent to the client.
 debug_pretty_print          | off                            | Indents parse and plan tree displays.
 debug_print_parse           | off                            | Logs each query's parse tree.
 debug_print_plan            | off                            | Logs each query's execution plan.
 debug_print_rewritten       | off                            | Logs each query's rewritten parse tree.
 event_source                | PostgreSQL                     | Sets the application name used to identify PostgreSQL messages in the event log.
 log_autovacuum_min_duration | -1                             | Sets the minimum execution time above which autovacuum actions will be logged.
 log_checkpoints             | on                             | Logs each checkpoint.
 log_connections             | off                            | Logs each successful connection.
 log_destination             | stderr                         | Sets the destination for server log output.
 log_directory               | pg_log                         | Sets the destination directory for log files.
 log_disconnections          | off                            | Logs end of a session, including duration.
 log_duration                | off                            | Logs the duration of each completed SQL statement.
 log_error_verbosity         | terse                          | Sets the verbosity of logged messages.
 log_file_mode               | 0600                           | Sets the file permissions for log files.
 log_filename                | postgresql-%Y-%m-%d_%H%M%S.log | Sets the file name pattern for log files.
 log_hostname                | off                            | Logs the host name in the connection logs.
 log_line_prefix             | %t [%p]: [%l-1] user=%u,db=%d  | Controls information prefixed to each log line.
 log_lock_waits              | on                             | Logs long lock waits.
 log_min_duration_statement  | 250                            | Sets the minimum execution time above which statements will be logged.
 log_min_error_statement     | error                          | Causes all statements generating error at or above this level to be logged.
 log_min_messages            | warning                        | Sets the message levels that are logged.
 log_rotation_age            | 1440                           | Automatic log file rotation will occur after N minutes.
 log_rotation_size           | 10240                          | Automatic log file rotation will occur after N kilobytes.
 log_statement               | none                           | Sets the type of statements logged.
 log_temp_files              | 0                              | Log the use of temporary files larger than this number of kilobytes.
 log_timezone                | UTC                            | Sets the time zone to use in log messages.
 log_truncate_on_rotation    | off                            | Truncate existing log files of same name during log rotation.
 logging_collector           | off                            | Start a subprocess to capture stderr output and/or csvlogs into log files.
 syslog_facility             | local0                         | Sets the syslog "facility" to be used when syslog enabled.
 syslog_ident                | postgres                       | Sets the program name used to identify PostgreSQL messages in syslog.

Спасибо заранее.


Могу предложить костыль в виде настройки logroate.
Ротацию можно настроить как по размеру, так и по дате (резать каждый день) или всё одновременно. Ещё оно пакует старые логи.

Deleted
()
Ответ на: комментарий от Deleted

так вон же они, настройки логгера, он сам нарежет и заротирует:
log_rotation_age и log_rotation_size

ТС, а какая версия постгреса?

SevikL ★★★★★
()
Последнее исправление: SevikL (всего исправлений: 2)
Ответ на: комментарий от Deleted

Ну это действительно немного костыльно, но я уже думал об этом, если не получится решить штатными средствами.

Sirko
() автор топика
Ответ на: комментарий от SevikL

Да, но вот эти настройки, насколько я понял действуют только если явно настроить logging_collector, а он у меня отключен:

postgres=# show logging_collector;
 logging_collector 
-------------------
 off
(1 row)

и логи пишутся в /var/log/postgresql/postgresql-9.3-main.log

Версия postgresql соответственно - 9.3 :

  9.3.18-0ubuntu0.14.04.1 
Sirko
() автор топика

Было предположение, что это может быть из-за логирования медленных запросов, выставил значение для:

log_min_error_statement

в -1

По идее, должно было вообще отключить логирование медленных запросов, но нет - продолжаются сыпаться в лог. Релоад конфига - делал.

Не могу понять что не так (

Sirko
() автор топика

форумы/выдачу google перелопатил

Документацию читать не пробовал? https://www.postgresql.org/docs/9.3/static/runtime-config-logging.html

Тебе скорее нужен log_min_messages, а не log_error_verbosity.

set log_error_verbosity to 'TERSE';
Потом делал:
select pg_reload_conf();
Но безрезультатно.

Ты сначала меняешь runtime конфигурацию, а потом перечитываешь конфиги с диска.

Куда еще можно посмотреть?

В документацию.

Deleted
()
Ответ на: комментарий от Deleted

Да, я уже разобрался как правильно сделать, и про runtime тоже уже знаю :)

Спасибо всем откликнувшимся за помощь.

Sirko
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.