Reading the SQL errorlog

Yesterday I was doing an analysis of the SQL errorlog in response to a cluster node that had been crashing frequently.

First I noticed there's a rather annoying bug in SQL Server Management Studio: if you press the filter button before all the log files are read (if you select more then one) you will only filter based on the part of the log that's already read by the Management Studio. I saw huge holes in my log files with entire days missing and thought we might have a serious problem until I discovered that data I had read previously was now gone.

Besides this annoying bug it's rather painful to examine the tabular data of the errorlog window by hand and I was wondering if there were some way I could do this in SQL. I looked in the SQL help, but couldn't find anything to help me except a function in SQL-DMO I was unable to call from T-SQL. Today Google helped me out and provided me with the solution: sp_readerrorlog.

This stored procedure is nicely documented at http://vyaskn.tripod.com/sp_readerrorlog_undocumented.htm and it appears that you can read any text file that SQL Server can access into a table with this stored procedure, which could come in handy some other time.