Last active
July 20, 2024 21:23
-
-
Save shaheerxt/a82bae7255ff2d899ce805df0095693f to your computer and use it in GitHub Desktop.
SAP HANA Auditing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Please enable the auditing on database as documented in https://gist.github.com/shaheerxt/2ceda6c2d49e1fd33187428ff9da5a0b | |
-- Setup Policy as SYSTEM user (On the database - SYSTEMDB or TENANT DB): | |
CREATE AUDIT POLICY "AUDIT-USER_CONNECT_FAILURES" AUDITING UNSUCCESSFUL CONNECT LEVEL INFO; | |
-- Query to check if there are failures: | |
select * | |
from audit_log | |
where audit_policy_name = 'AUDIT-USER_CONNECT_FAILURES' | |
order by timestamp desc | |
limit 100; | |
-- You may want to check minutes aggregation if you have an application that often makes unsuccessful connections the database. | |
select current_database() DB_NAME, | |
to_char(timestamp, 'YYYY-MM-DD HH24:MI') as MINUTE_OF_DAY, | |
CLIENT_HOST, | |
APPLICATION_USER_NAME, | |
EVENT_STATUS, | |
count(*) | |
from audit_log | |
where audit_policy_name = 'AUDIT-USER_CONNECT_FAILURES' | |
group by current_database(), | |
to_char(timestamp, 'YYYY-MM-DD HH24:MI'), | |
CLIENT_HOST, | |
APPLICATION_USER_NAME, | |
EVENT_STATUS | |
order by 1 desc | |
limit 100; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment