Script to monitor error log and event log

  • What is the best way to monitor error log and event log continuously and alert as email. In my current work environment I do not have the privilege of using monitoring tools to monitor.The only option left out for me is to develop a script to monitor the error log and event log. I am not quite sure if there is any other monitoring mechanism available in sqlserver to alert us the error log and event log errors. Kindly share your ideas and thoughts in this regard.

  • I wrote two different blogs on this that should give you a start:

    T-SQL to query ERRORLOG...you'll need to set up alerting on your own:
    http://dallasdbas.com/query-your-sql-server-errorlogs/

    Powershell script, step by step for event logs:
    http://dallasdbas.com/getting-to-know-powershell-from-an-old-dba/

    The Powershell one is a bit ugly as the formatting didn't carry over when I changed blog hosts.  Also, I switched from Get-EventLog to Get-WinEvent in order to capture 'Critical'.   Schedule this to run via Windows Task Scheduler.

    Hope this gets you started!

    ------------------------------------------------------------------------------------------------Standing in the gap between Consultant and ContractorKevin3NFDallasDBAs.com/BlogWhy is my SQL Log File HUGE?!?![/url]The future of the DBA role...[/url]SQL Security Model in Plain English[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply