How to use xp_readerrorlog parameters to search SQL Error Logs

06 March,2016 by Jack Vamvas

Go beyond the manual opening of SQL Server Error Logs and SQL Agent Error Logs by using the xp_readerrorlog procedure. Your life will suddenly become easier .

These commands will get you started .

--reads the current SQL Server Error log
xp_readerrorlog 0


--reads the second SQL Server Error Log
xp_readerrorlog 2


--reads the current SQL Agent Logs
xp_readerrorlog 0,2


--reads the current SQL Server Error log with the search string 'Login'
xp_readerrorlog 0, 1, "Login"


----reads the current SQL Server Error log with the search string 'Login' and 'failed'
xp_readerrorlog 0, 1, "Login","failed"


----reads the current SQL Server Error log with the search string 'Login' and 'failed',since 20160306 and up to 20160307
xp_readerrorlog 0, 1, "Login","failed" ,'20160306','20160307'


--reads the current SQL Server Error Logs in descending order
xp_readerrorlog 0, 1, NULL, NULL, NULL, NULL, N'desc'

 

Read More on Error Logs

 SQL Server – Reading and Deleting SQL Server Error Log files ...

SQL Server - Powershell and SQL Error Logs - SQL Server DBA

SQL Server Error Log Check - SQL Server DBA

SQL Server – Error Logs recycle without SQL Server Restart - SQL ...


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to use xp_readerrorlog parameters to search SQL Error Logs


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer