Pgpool-II のログ出力設定メモ。
設定
- /etc/pgpool-II/pgpool.conf の設定
# - Where to log - log_destination = 'syslog' # Where to log # Valid values are combinations of stderr, # and syslog. Default to stderr. # - What to log - log_line_prefix = '%t:, pid:%p, proc_name:%P, db_name:%d, user:%u, app_name:%a, line_num:%l, ' # printf-style string to output at beginning of each log line. log_connections = off # Log connections log_hostname = on # Hostname will be shown in ps status # and in logs if connections are logged log_statement = on # Log all statements log_per_node_statement = on # Log all statements # with node and backend informations log_client_messages = on # Log any client messages log_standby_delay = 'none' # Log standby delay # Valid values are combinations of always, # if_over_threshold, none
- /etc/rsyslog.conf の設定
# Pgpool-II
local0.* /var/log/pgpool.log
- Pgpool-II 再起動
$ sudo systemctl restart pgpool.service
- rsyslogd 再起動
$ sudo systemctl restart rsyslog
ログ出力例
- /var/log/pgpool/pgpool.log
Oct 26 22:10:42 ip-172-17-4-52 pgpool[14790]: [1-1] 2020-10-26 22:10:42:, pid:14790, proc_name:MAIN, db_name:[No Connection], user:[No Connection], app_name:[No Connection], line_num:1, LOG: stop request sent to pgpool. waiting for termination... Oct 26 22:10:43 ip-172-17-4-52 pgpool[14794]: [1-1] 2020-10-26 22:10:43:, pid:14794, proc_name:MAIN, db_name:[No Connection], user:[No Connection], app_name:[No Connection], line_num:1, LOG: memory cache initialized Oct 26 22:10:43 ip-172-17-4-52 pgpool[14794]: [1-2] 2020-10-26 22:10:43:, pid:14794, proc_name:MAIN, db_name:[No Connection], user:[No Connection], app_name:[No Connection], line_num:2, DETAIL: memcache blocks :64 Oct 26 22:10:43 ip-172-17-4-52 pgpool[14794]: [2-1] 2020-10-26 22:10:43:, pid:14794, proc_name:MAIN, db_name:[No Connection], user:[No Connection], app_name:[No Connection], line_num:3, LOG: pool_discard_oid_maps: discarded memqcache oid maps Oct 26 22:10:43 ip-172-17-4-52 pgpool[14794]: [3-1] 2020-10-26 22:10:43:, pid:14794, proc_name:MAIN, db_name:[No Connection], user:[No Connection], app_name:[No Connection], line_num:4, LOG: Setting up socket for 0.0.0.0:9999 Oct 26 22:10:43 ip-172-17-4-52 pgpool[14794]: [4-1] 2020-10-26 22:10:43:, pid:14794, proc_name:MAIN, db_name:[No Connection], user:[No Connection], app_name:[No Connection], line_num:5, LOG: Setting up socket for :::9999 Oct 26 22:10:43 ip-172-17-4-52 pgpool[14794]: [5-1] 2020-10-26 22:10:43:, pid:14794, proc_name:MAIN, db_name:[No Connection], user:[No Connection], app_name:[No Connection], line_num:6, LOG: find_primary_node_repeatedly: waiting for finding a primary node Oct 26 22:10:43 ip-172-17-4-52 pgpool[14828]: [6-1] 2020-10-26 22:10:43:, pid:14828, proc_name:PCP CHILD, db_name:[No Connection], user:[No Connection], app_name:[No Connection], line_num:1, LOG: PCP process: 14828 started Oct 26 22:10:43 ip-172-17-4-52 pgpool[14794]: [6-1] 2020-10-26 22:10:43:, pid:14794, proc_name:MAIN, db_name:[No Connection], user:[No Connection], app_name:[No Connection], line_num:7, LOG: pgpool-II successfully started. version 4.1.3 (karasukiboshi) Oct 26 22:10:43 ip-172-17-4-52 pgpool[14794]: [7-1] 2020-10-26 22:10:43:, pid:14794, proc_name:MAIN, db_name:[No Connection], user:[No Connection], app_name:[No Connection], line_num:8, LOG: node status[0]: 0 Oct 26 22:10:43 ip-172-17-4-52 pgpool[14794]: [8-1] 2020-10-26 22:10:43:, pid:14794, proc_name:MAIN, db_name:[No Connection], user:[No Connection], app_name:[No Connection], line_num:9, LOG: node status[1]: 0 Oct 26 22:11:05 ip-172-17-4-52 pgpool[14807]: [5-1] 2020-10-26 22:11:05:, pid:14807, proc_name:CHILD, db_name:writer, user:awsuser, app_name:psql, line_num:1, LOG: Query message from frontend. Oct 26 22:11:05 ip-172-17-4-52 pgpool[14807]: [5-2] 2020-10-26 22:11:05:, pid:14807, proc_name:CHILD, db_name:writer, user:awsuser, app_name:psql, line_num:2, DETAIL: query: "select inet_server_addr();" Oct 26 22:11:05 ip-172-17-4-52 pgpool[14807]: [6-1] 2020-10-26 22:11:05:, pid:14807, proc_name:CHILD, db_name:writer, user:awsuser, app_name:psql, line_num:3, LOG: statement: select inet_server_addr(); Oct 26 22:11:05 ip-172-17-4-52 pgpool[14807]: [7-1] 2020-10-26 22:11:05:, pid:14807, proc_name:CHILD, db_name:writer, user:awsuser, app_name:psql, line_num:4, LOG: DB node id: 0 backend pid: 28282 statement: SELECT version() Oct 26 22:11:05 ip-172-17-4-52 pgpool[14807]: [8-1] 2020-10-26 22:11:05:, pid:14807, proc_name:CHILD, db_name:writer, user:awsuser, app_name:psql, line_num:5, LOG: pool_reuse_block: blockid: 0 Oct 26 22:11:05 ip-172-17-4-52 pgpool[14807]: [8-2] 2020-10-26 22:11:05:, pid:14807, proc_name:CHILD, db_name:writer, user:awsuser, app_name:psql, line_num:6, CONTEXT: while searching system catalog, When relcache is missed Oct 26 22:11:05 ip-172-17-4-52 pgpool[14807]: [9-1] 2020-10-26 22:11:05:, pid:14807, proc_name:CHILD, db_name:writer, user:awsuser, app_name:psql, line_num:7, LOG: DB node id: 1 backend pid: 30080 statement: select inet_server_addr();