A company’s security audit requires generating a report listing all Snowflake logins (e.g., date and user) within the last 90 days.
Which of the following statements will return the required information?
A company’s security audit requires generating a report listing all Snowflake logins (e.g., date and user) within the last 90 days.
Which of the following statements will return the required information?
To generate a report listing all Snowflake logins within the last 90 days, the appropriate statement is to query the LOGIN_HISTORY view in the ACCOUNT_USAGE schema. This view contains login events and can be filtered for the desired time range, covering the necessary information (date and user). Therefore, retrieving EVENT_TIMESTAMP and USER_NAME from ACCOUNT_USAGE.LOGIN_HISTORY is the correct approach.
correct
D - Correct https://docs.snowflake.com/en/sql-reference/account-usage/login_history B - Incorrect as login_history_by_user function returns login activity within the last 7 days only. https://docs.snowflake.com/en/sql-reference/functions/login_history
B will be correct only if information needs to be fetched within 7 days
B. SELECT EVENT_TIMESTAMP, USER_NAME FROM table(information_schema.login_history_by_user()) The statement in option B will return the required information of the Snowflake logins (date and user) within the last 90 days. The information_schema.login_history_by_user function returns information about logins to the account by individual users. The returned columns include EVENT_TIMESTAMP and USER_NAME, which can be used to generate the report listing all Snowflake logins within the last 90 days by filtering the results to only show logins within the specified timeframe.
The function return login activity only within the last 7 days. So, for 8 to 365 days you'll need to reach the account usage login history view https://docs.snowflake.com/en/sql-reference/functions/login_history
D. SELECT EVENT_TIMESTAMP, USER_NAME FROM ACCOUNT_USAGE.LOGIN_HISTORY is correct
Verified
It needs to be in a predicate https://docs.snowflake.com/en/sql-reference/functions/login_history.html
Only 7 days so B is not right.
LOGIN_HISTORY returns login events within a specified time range. https://docs.snowflake.com/en/sql-reference/functions/login_history.html