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

Add message_type for PGAUDIT #115

Open
qguang opened this issue Jul 24, 2023 · 1 comment
Open

Add message_type for PGAUDIT #115

qguang opened this issue Jul 24, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@qguang
Copy link

qguang commented Jul 24, 2023

PGAUDIT print message lines as below.
2023-07-24 01:53:45 UTC:[local]:postgres@crm_database:[68]: LOG: statement: revoke create on schema public from public; 2023-07-24 01:53:45 UTC:[local]:postgres@crm_database:[68]: LOG: AUDIT: SESSION,1,1,ROLE,REVOKE,,,revoke create on schema public from public;,<not logged> 2023-07-24 01:53:45 UTC:[local]:postgres@crm_database:[68]: LOG: statement: create schema crm_data authorization crm_adm_user; 2023-07-24 01:53:45 UTC:[local]:postgres@crm_database:[68]: LOG: AUDIT: SESSION,2,1,DDL,CREATE SCHEMA,,,create schema crm_data authorization crm_adm_user;,<not logged> 2023-07-24 01:53:45 UTC:[local]:postgres@crm_database:[68]: LOG: statement: alter schema public owner to crm_adm_user;

Is it possible to add more values to _types_prefixes?
_types_prefixes = {
"duration: ": "duration",
"connection ": "connection",
"disconnection": "connection",
"automatic analyze": "analyze",
"checkpoint ": "checkpoint",
"AUDIT:": "pgaudit",
}

@dlax
Copy link
Member

dlax commented Jul 31, 2023

Handling more message types would indeed make sense; but this should not be implemented by hard-coding another value, rather by adding a mechanism to extend the prefix-to-message_type map from user code. Something like:

import pgtoolkit.log

pgtoolkit.log.Record.register_message_type("AUDIT", "audit")
pgtoolkit.log.parse(...)

Or maybe as a parameter to parse()?

@dlax dlax added the enhancement New feature or request label Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants