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
| Kolom | Beschrijving |
|---|---|
| date | Datum |
| user_name | Gebruiker |
| role_name | Gebruikte systeemrol |
| query_type | Bijv. SELECT, ALTER, GRANT |
| execution_status | SUCCESS, FAIL of INCIDENT |
| statement | Volledige 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;