dolfinus opened a new issue, #49915:
URL: https://github.com/apache/doris/issues/49915

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Description
   
   Currently audit log contains information like client IP, user name, 
statement, status and so on. But it is unknown if a set of queries are a part 
of some specific session/connection, or are executed independently.
   
   Other databases like Postgres allow to track each session specifically:
   * There is a 
[pg_stat_activity](https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW)
 view which returns state of currently executed sessions in the system.
   * Sessions have a name which is set using 
[ApplicationName](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-APPLICATION-NAME)
 client parameter. So session can be tracked by explicit name given by a user, 
and not by some random ID (which user doesn't know or log on client side in 
most cases).
   * Audit extensions (e.g. pg_proaudit) include [session identifier 
column](https://postgrespro.ru/docs/postgrespro/14/pg-proaudit?lang=en#PG-PROAUDIT-VIEWING-SECURITY-EVENT-LOG)
   
   Finally, the combination of session_id + timestamp + query_id can tell 
everything which was done by specific session, and in which order.
   
   But currently I don't see how this can be implemented in Doris:
   * There is no session/application/connection state concept. I don't see any 
views which can return this information.
   * There is no client/protocol option which accepts user-specified 
session/connection name, and saves it into some database object/view which can 
be used for introspection or audit.
   * There is no sessionId/connectionId column in audit event, so queries 
cannot be grouped by connection, they all seems to be totally independent.
   
   Please consider implementing:
   * system view or table with list of currently opened connections/sessions
   * connection/session name should be explicitly set by user
   * audit logs should contain connection/session id and name
   
   ### Use case
   
   Inspection of audit logs can give information about specific user and query 
which was executed by Doris. But it don't give any information about 
application or script which executed this query, so this becomes hard to track 
down falling query source.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to