SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Failed and Successful Login Auditing Using xp_readerrorlog

By Ryan Loftin,

Use this script to audit logins on your server.  Undocumented extended stored procedure xp_readerrorlog will pull all rows within your designated search criteria and dump the data into a temp table.  From there a second temp table is created to find your failed logins and group them per User, IP and Month.  The third temp table is used to find your last successful login per User and IP.

** Note that you must be logging both successful and failed logins in server properties to pull users last login.

Total article views: 921 | Views in the last 30 days: 2
 
Related Articles
FORUM

logins

logins

FORUM

Logins

Delete logins

FORUM

Logins

Logins

FORUM

Login locked

Login locked

FORUM

user,login

user,login

Tags
auditing    
login    
 
Contribute