Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: add ability to prefix application_name to logs #480

Open
mikkorantalainen opened this issue Apr 22, 2020 · 0 comments
Open

RFE: add ability to prefix application_name to logs #480

mikkorantalainen opened this issue Apr 22, 2020 · 0 comments

Comments

@mikkorantalainen
Copy link

We're running pgbouncer 1.7 in production with high load and getting random failures with following in pgbouncer logs:

2020-04-20 08:51:42.513 2653 WARNING C-0x234e898: incoming-database/real-database@127.0.0.1:40974 Pooler Error: client_idle_timeout

(This particular message appears in the log after the connection between client and postgresql backend has hanged for long enough time - the actual issue is still under investigation and this issue is not about the actual error in example.)

It's really hard to correlate this message to any client transaction we have. The PostgreSQL server supports log_line_prefix (https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-LINE-PREFIX) which supports adding application_name to any log messages emitted.

Our client executes SET LOCAL application_name='unique-identifier-123' at the start of every transaction. We're using following setting for postgresql and it would be awesome if pgbouncer supported something similar in the future:

log_line_prefix='%m %u@%d/%p %a: '

Of course, pgbouncer has stuff that normal postgresql does not have such as potentially different database name on the incoming connection vs actual database name used with postgresql. As such, pgbouncer should support more escape sequences than postgresql itself. It would be nice to use as many escape sequences with the same meaning as possible. I think that if pgbouncer needs some escape sequences for stuff that postgresql does not have it might be good to reuse some of the sequences that pgbouncer does not need (e.g. %v or %x) so that there is not a risk for collision in future if/when postgresql introduces new sequences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant