feat: Add JSON logging

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2026-06-30 12:44:42 +02:00
commit e72feaf0f6
Signed by: jriou
GPG key ID: 9A099EDA51316854
8 changed files with 77 additions and 13 deletions

View file

@ -131,5 +131,13 @@ The following placeholders are available to format log messages using `log-forma
* `%q`: query
* `%a`: application name
Set `log-format` to `json` to log each session as a JSON object instead:
```
pgterminate -log-format json
```
Keys are `pid`, `user`, `database`, `client`, `state`, `query`, `state_duration` and `application_name`. With `log-destination: file`, a `timestamp` key is added to each object.
# License
`pgterminate` is released under [The Unlicense](LICENSE) license. Code is under public domain.