PostgreSQL

CentOS

1. postgresql.conf ์ˆ˜์ •

> ์‚ฌ์ „ Syslog ์„ค์น˜ ํ•„์š”
> Config ์œ„์น˜ ํ™•์ธ

[config ๊ฒฝ๋กœ ์˜ˆ์‹œ] /var/lib/pgsql/9.6/data/postgresql.conf
[์ˆ˜์ • ์˜ˆ์‹œ] # ERROR REPORTING AND LOGGING ํ•˜๋‹จ์—์„œ ์ˆ˜์ •
log_destination = โ€˜stderrโ€™ ๋ผ์ธ์„ ์ฃผ์„์ฒ˜๋ฆฌ
log_destination = โ€˜syslogโ€™ ๋ผ์ธ ์ถ”๊ฐ€

# These are relevant when logging to syslog: ํ•˜๋‹จ์˜ ๋‹ค์Œ 4๋ผ์ธ ์ฃผ์„ ํ•ด์ œ
#syslog_facility = โ€˜LOCAL0โ€™
#syslog_ident = โ€˜postgresโ€™
#syslog_sequence_numbers = on
#syslog_split_messages = on

2. PostgreSQL ๋ฐ Syslog ์žฌ์‹œ์ž‘

  • ๋ฒ„์ „์— ๋”ฐ๋ผ ์„œ๋น„์Šค๋ช…์ด ๋‹ค๋ฅด๋ฏ€๋กœ ๋ฒ„์ „ ํ™•์ธ

psql โ€“version
[๋ฒ„์ „ ์ถœ๋ ฅ ์˜ˆ์‹œ] psql (PostgreSQL) 9.6.15
[์„œ๋น„์Šค๋ช… ํ™•์ธ ๊ฒฝ๋กœ ์˜ˆ์‹œ] /etc/systemd/system/multi-user.target.wants/postgresql-9.6.service
[์œ„์˜ ์˜ˆ์‹œ๋กœ ํ™•์ธ๋œ ๋ฒ„์ „์— ๋”ฐ๋ฅธ ์žฌ์‹œ์ž‘ ์˜ˆ์‹œ] service postgresql-9.6 restart
service rsyslog restart

3. ๋กœ๊ทธ ํ™•์ธ

https://docs.plura.io/ko/fn/comm/filter/syslog


Ubuntu

1. postgresql.conf ์ˆ˜์ •

> ์‚ฌ์ „ Syslog ์„ค์น˜ ํ•„์š”
> Config ์œ„์น˜ ํ™•์ธ

 [config ๊ฒฝ๋กœ ์˜ˆ์‹œ] /var/lib/pgsql/9.6/data/postgresql.conf
 [์ˆ˜์ • ์˜ˆ์‹œ] # ERROR REPORTING AND LOGGING ํ•˜๋‹จ์—์„œ ์ˆ˜์ •
 log_destination = โ€˜stderrโ€™ ๋ผ์ธ์„ ์ฃผ์„์ฒ˜๋ฆฌ
 log_destination = โ€˜syslogโ€™ ๋ผ์ธ ์ถ”๊ฐ€

 # These are relevant when logging to syslog: ํ•˜๋‹จ์˜ ๋‹ค์Œ 4๋ผ์ธ ์ฃผ์„ ํ•ด์ œ
 #syslog_facility = โ€˜LOCAL0โ€™
 #syslog_ident = โ€˜postgresโ€™
 #syslog_sequence_numbers = on
 #syslog_split_messages = on

2. PostgreSQL ๋ฐ Syslog ์žฌ์‹œ์ž‘

systemctl restart postgresql
service rsyslog restart

3. ๋กœ๊ทธ ํ™•์ธ

  • ๋กœ๊ทธ ์˜ˆ์‹œ : ์ „์ฒด๋กœ๊ทธ > ํ˜ธ์ŠคํŠธ

https://docs.plura.io/ko/fn/comm/filter/syslog

Last updated