Open mujiqadri opened 8 years ago
Use Loghost to get the hostName of the user executing the query, find a library which can search the latitude, logitude of this host.
select loghost, * from gp_toolkit.__gp_log_master_ext --where loghost like '%coegeco%' order by logtime desc limit 100
When fetching queries from Cluster, get the logUser who ran the query, pass this as a parameter for processSQL, and when the parsing is successful, Save the columns and tables accessed by the User in QueryAuditTrail table
QueryAuditTrail (QueryId, LogUser, AccessTime, DatabaseName, SchemaName, Table, Column, UsageType, UsageLoc, IPAddress, GeoLocation)
Possible Values for UsageType = (1 for Select), (2 for Insert), (3 for Delete), (4 for Update), (5 for Alter), (6 for Drop), (7 for Create) Possible Values for UsageLoc = (1 For "in_select"), ( 2 For "in_set"), (3 for "in_where"), ( 4 for "in_groupby"), (5 For "in_having"), (6 For "in_orderby")