SQL Server Agent Log and SQL Server Error Log metrics allow users to trigger an alert based on certain text or regular expressions. SQL Diagnostic Manager provides different levels of alerts so you can select whether you want to generate a critical, warning, or informational alert based on your entered data. You can also limit the size of your logs to decrease your response time and avoid using additional space on your server.
To use ad hoc Alert Configuration to enter text or a regular expression to trigger an alert:
- Right-click the appropriate SQL Server instance, and select Configure Alerts.
- Select the metric for which you want to configure an alert.
- Click Advanced.
- Under What text would you like to raise alerts for? Type the text in the appropriate field. Use semicolons to separate names and a percent (%) character as a wildcard.
- Under What regular expressions would you like to raise alerts for? Type the expression in the appropriate field. Type only one regular expression per line.
- Click OK.
To use Alert Configuration Templates to enter text or a regular expression to trigger an alert:
- Click and select Alert Configuration Templates.
- Click New or select an existing template, and then click View/Edit.
- If you clicked New , type a name, and then click Edit Configuration.
- If you clicked View/Edit , click Edit Configuration.
- Select the metric for which you want to configure an alert.
- Click Advanced.
- Under What text would you like to raise alerts for? Type the text in the appropriate field. Use semicolons to separate names and a percent (%) character as a wildcard.
- Under What regular expressions would you like to raise alerts for? Type the expression in the appropriate field. Type only one regular expression per line.
- Click OK.
Limit the size of a log that SQL Diagnostic Manager reads
In an attempt to improve response time and avoid using unnecessary space on your server, you can designate the maximum size of your SQL Server Agent log and your SQL Server Error log that SQL Diagnostic Manager reads. When a log reaches the size limit set in the Alert Configuration, it triggers an alert. SQL Diagnostic Manager does not display in the Logs view any data from error or agent logs in excess of the size limit. A quick solution to decrease the size of your file is to click Cycle Server Log to archive the information in the most recent log and start a new log. You can also cycle the log using SSMS.
Before cycling your log, it is important to note that if you have a limit set, then the log file deleted is the oldest log file stored. If you want to keep that log file, copy the file elsewhere before cycling the log.
SQL Server 2000 users also must restart the SQL Server Agent Service after cycling the SQL Server Agent log. The only way to cycle the agent log on SQL Server is to cycle the agent service. This process results in a new log.
To adjust the log size limit that SQL Diagnostic Manager reads:
- View the Alert Configuration for your monitored SQL Server instance.
- Select either the SQL Server Agent Log or the SQL Server Error Log alert, and click Advanced.
- In the Alert Filters tab, adjust the Size (MB) field based on what you want for your log size limit.
- Click OK, and then click Apply.
- Click OK in the confirmation message if you want to apply your change to any other SQL Server instances, or click No.