pg.ddx.io  pgaudit/pgaudit GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgaudit/pgaudit] issue #281: Issues w.r.t to Azure Postgres Audit logging
5+ messages / 2 participants
[nested] [flat]

* [pgaudit/pgaudit] issue #281: Issues w.r.t to Azure Postgres Audit logging
@ 2025-07-28 19:17 "Vasukhi-ks (@Vasukhi-ks)" <noreply+Vasukhi-ks@github.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Vasukhi-ks (@Vasukhi-ks) @ 2025-07-28 19:17 UTC (permalink / raw)
  To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>

Hello Team,

I have a scenario which i was testing for Azure Postgres Auditing for Postgres version 16.8 running on Azure.
Currently I am trying to achieve Database and Object level auditing for one particular Database.
Below are the steps which I have followed, 
1. Set [pgaudit.log] at Server level to none.
2. ALTER DATABASE Vaccum set pgaudit.log='Read'; --- Set Auditing at DB Level.
3. ALTER ROLE readonly_role set pgaudit.log='Read'; --- Set Auditing at ROle level.

I was able to notice Audit logs for some of the transaction.

Later, I disable Auditing at Database and Role level and tried running few transactions.

Surprisingly I was still able to track transactions in my audit logs. Need to understand this behavior on why i am still able to notice transaction after i set audit log to None at both Database and Role level.

Would be great if anyone can help me on this.

Regards,
Vasukhi K S

Sharing few screenshots

<img width="1508" height="389" alt="Image" src="https://github.com/user-attachments/assets/8f8b08c8-35df-4c76-bd27-8abda3f1aab2"; />
<img width="887" height="597" alt="Image" src="https://github.com/user-attachments/assets/6aa68d17-f969-46b7-a279-7a648fa5bad1"; />

 

^ permalink  raw  [nested|flat] 5+ messages in thread

* Re: [pgaudit/pgaudit] issue #281: Issues w.r.t to Azure Postgres Audit logging
@ 2026-06-26 03:50 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
  3 siblings, 0 replies; 5+ messages in thread

From: dwsteele (@dwsteele) @ 2026-06-26 03:50 UTC (permalink / raw)
  To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>

@dwsteele assigned @dwsteele.

^ permalink  raw  [nested|flat] 5+ messages in thread

* Re: [pgaudit/pgaudit] issue #281: Issues w.r.t to Azure Postgres Audit logging
@ 2026-06-26 03:50 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
  3 siblings, 0 replies; 5+ messages in thread

From: dwsteele (@dwsteele) @ 2026-06-26 03:50 UTC (permalink / raw)
  To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>

@dwsteele applied label "question".

^ permalink  raw  [nested|flat] 5+ messages in thread

* Re: [pgaudit/pgaudit] issue #281: Issues w.r.t to Azure Postgres Audit logging
@ 2026-06-26 03:55 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
  3 siblings, 0 replies; 5+ messages in thread

From: dwsteele (@dwsteele) @ 2026-06-26 03:55 UTC (permalink / raw)
  To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>

@dwsteele closed this.

^ permalink  raw  [nested|flat] 5+ messages in thread

* Re: [pgaudit/pgaudit] issue #281: Issues w.r.t to Azure Postgres Audit logging
@ 2026-06-26 03:55 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
  3 siblings, 0 replies; 5+ messages in thread

From: dwsteele (@dwsteele) @ 2026-06-26 03:55 UTC (permalink / raw)
  To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@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.

^ permalink  raw  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2026-06-26 03:55 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-28 19:17 [pgaudit/pgaudit] issue #281: Issues w.r.t to Azure Postgres Audit logging "Vasukhi-ks (@Vasukhi-ks)" <noreply+Vasukhi-ks@github.com>
2026-06-26 03:50 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
2026-06-26 03:50 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
2026-06-26 03:55 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>
2026-06-26 03:55 ` "dwsteele (@dwsteele)" <noreply+dwsteele@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox