문제

I'm not much familiar with postgresql. I like to setup postgres application_name feature to log database changes (update/delete) in a history table.

I tried to find any help from online but couldn't find any article with basic steps. Could someone give me any kind of help.

Thanks alot!

도움이 되었습니까?

해결책

Using a application_name is great idea. It has a two steps:

  1. logging application name - set log_line_prefix in postgresql.conf
    log_line_prefix = '%a %u %d' 
  2. use application name - use SQL configuration statement or variable in connection string or environment variable
    SET application_name = 'myapp';
    or
    postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
    or
    PGAPPNAME=splunk psql -c "select application_name from pg_stat_activity where pid = pg_backend_pid();" postgres

some documentation

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top