From: dwsteele (@dwsteele) <noreply+dwsteele@github.com>
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
Subject: Re: [pgaudit/pgaudit] issue #281: Issues w.r.t to Azure Postgres Audit logging
Date: Fri, 26 Jun 2026 03:55:45 +0000
Message-ID: <gh-pgaudit-pgaudit-281-c4806221615@github.com> (raw)
In-Reply-To: <gh-pgaudit-pgaudit-281@github.com>
References: <gh-pgaudit-pgaudit-281@github.com>
Thanks for the report. Before we dig in, I want to clarify how these settings behave, because what you're describing is most likely expected PostgreSQL behavior rather than a pgaudit bug.
### 1. `ALTER DATABASE … SET` and `ALTER ROLE … SET` only take effect for *new* sessions
These values are applied when a session starts — they are **not** pushed to backends that are already connected. On Azure Flexible Server this matters a lot, because connections typically go through the built-in pooler (PgBouncer). A pooled backend that started while `pgaudit.log = 'Read'` was in effect will keep logging until that backend is recycled, even after you've "disabled" the setting.
To confirm what's actually in effect, open a **brand-new** connection and run the following in the same session whose statements are showing up in the log:
```sql
SHOW pgaudit.log;
```
### 2. Role settings override database settings
Precedence (lowest → highest) is:
```
server config → ALTER DATABASE → ALTER ROLE → ALTER ROLE … IN DATABASE → per-session SET
```
If you cleared only one level, another may still apply. "Disabling" should be an explicit `RESET` (or `SET … = 'none'`) at **each** level you previously set. You can see what's still configured with:
```sql
SELECT * FROM pg_db_role_setting; -- or \drds in psql
```
### 3. Object-level auditing is independent of `pgaudit.log`
If `pgaudit.role` is configured and that role has been granted privileges on the objects you're reading, those events are logged regardless of `pgaudit.log`. Worth ruling out:
```sql
SHOW pgaudit.role;
```
### What would help us investigate
- [ ] Output of `SHOW pgaudit.log;` from a **fresh** connection in the affected session
- [ ] The exact `ALTER` statements you used to disable auditing
- [ ] `SELECT * FROM pg_db_role_setting;`
- [ ] `SHOW pgaudit.role;`
- [ ] A few of the actual audit log lines (the `AUDIT: SESSION/OBJECT,...` entries)
- [ ] Whether you're connecting through the pooled port or directly
---
One more note: Azure Flexible Server wraps pgaudit in its own managed configuration and ships the output to its own diagnostic/log destination. If the settings above all look correct and events still appear, the behavior may be on the Azure integration side, which is outside what we control upstream — in that case Azure support would be the right place to follow up.
Since this is quite an old issue I'm going to close it, but feel free to respond with details if you want to dig into this.