Terug naar Utils

Snowflake · View

system_role_usage

Alle statements uitgevoerd onder ACCOUNTADMIN, SYSADMIN of SECURITYADMIN, inclusief mislukte pogingen. Handig voor audits en het detecteren van onverwacht gebruik van beheerdersdrol.

Bron: SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY · Latentie: ~45min

KolomBeschrijving
dateDatum
user_nameGebruiker
role_nameGebruikte systeemrol
query_typeBijv. SELECT, ALTER, GRANT
execution_statusSUCCESS, FAIL of INCIDENT
statementVolledige querytekst

Broncode

create_admin_views.sql
create or replace view system_role_usage
    comment = 'Statements executed under ACCOUNTADMIN, SYSADMIN or SECURITYADMIN, including failed attempts (source: SNOWFLAKE.ACCOUNT_USAGE)'
as
select start_time::date as date
     , user_name
     , role_name
     , query_type
     , execution_status
     , query_text as statement
  from snowflake.account_usage.query_history
 where upper(role_name) in ('ACCOUNTADMIN', 'SYSADMIN', 'SECURITYADMIN')
 order by start_time desc;