This is my 50th blog post! I’m going to do something a bit special.
The Error Log
I’ve found the SQL Server error log to be slightly underrated as a source of useful information for how your SQL Server instance is doing. It’s true that it’s easy to find yourself in a situation where the applications write tens of thousands of failed login messages per day, but if you can get past that, SQL Server might be telling you important stuff that you really need to know about. Examples that I’ve seen:
- Memory dumps
- non-yielding schedulers
- long I/Os
- latch timeouts
Maybe this an odd thing to do, but I’ve personally set up alerting to get an email whenever SQL Server writes something to the error log. Naturally I filter out a lot of benign and informational messages. This kind of alerting is useful because let’s face it, using SSMS to open the error log isn’t always the fastest operation in the world. And who even knows if Azure Data Studio can be used to view the error log?
What’s in your error log?
If you haven’t checked your error log in a while, I challenge you to do so on your next working day. You never know what you’ll find. I’m happy to share my own, but readers may be confused as I run a custom version of SQL Server:
Thanks for reading!
Are you saying anime girls were an error?
Shizuku is the most benign of all error messages.
“Your SQL Server was cryptojacked, un-animu the Error log for 10 QB”
Spid 63: Brining Usenet Back
I have an Agent Job that runs a stored procedure every 5 minutes to email me whatever showed up in the ERRORLOG in the last 5 minutes that doesn’t match a very long list of things to ignore. If you have something more event-driven, I’d love to see a blog post about that.
BTW, one notable issue with Azure SQL Database is there is no access to the ERRORLOG. sp_readerrorlog simply doesn’t exist.
I’m using SentryOne to do the alerting, so it’s not very interesting. I’m happy to share more details if that interests you though.
According to now dead blog post links, there appears to be a way to use extended events + service broker to do event-based error log alerting. I can’t say that I would try that though.