Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to capture SQL login details with Extended Events

Question :

Answer:   SQL Server  Extended Events are your friend . This example  creates a Extended Event for a logon called "mylogon".  When a connection based on the situations you requested a) new connection or b) connection from a connection pool  

CREATE EVENT SESSION [Track_Logon] ON SERVER 
ADD EVENT sqlserver.login(
    ACTION(sqlserver.client_hostname,sqlserver.nt_username,sqlserver.username)
    WHERE ([sqlserver].[session_server_principal_name]=N'mylogon'))
ADD TARGET package0.event_file(SET filename=N'C:\temp\track_logon.xel')
GO
ALTER EVENT SESSION [Track_Logon]  
ON SERVER  
STATE = start;  




This post first appeared on SQLSERVER-DBA.com, please read the originial post: here

Share the post

How to capture SQL login details with Extended Events

×

Subscribe to Sqlserver-dba.com

Get updates delivered right to your inbox!

Thank you for your subscription

×