In my previous articles, we have learned how to enable the logs for the following:
- Detailed Error Log
- Failed Request Tracing
- Web Server Logs
All of the above logs help us to troubleshoot the logs and fix the problems which our users face. However, it would be really nice to get email alerts, as soon as there is a problem in our website. Right? This is where the “Alert Rules” come into picture.
Let’s see how to configure Alert Rules for the errors in our Azure app Service – Web App.
Navigate to your app Service for which you would like to configure Alert Rules. By default, under the essentials tab of your app Service, you can view the following chart for the number of requests along with the HTTP Errors, as shown below:
In order to start configuring Alerts, you need to add the “Alerts” tile by customizing your app Service Dashboard, as shown below:
After clicking the “Add tiles” link, your Dashboard will look like:
In the left hand side, the “Tile Gallery” will be opened where you can pick the required Tiles and add them to your Dashboard. You just need to search for the required one, drag & drop the same into the section, given below the “Essentials” tab.
Once you are done, click “Done Customizing” button, shown below:
Let’s search for the “Alerts” tile in the “Tile Gallery” by filtering the tiles, as shown below:
In the “Tile Gallery” select “Operations” in the Categories; drop down to filter the options, as shown below:
Now, drag the “Alert Rules” tile and drop it in on the section available in the right hand side, as shown below:
As soon as you drop the Tile, it will be something, as shown below:
Now, we are done with Configuring the “Alert Rules” tile to our Dashboard. Thus, click “Done Customizing” button.
Now, click anywhere on the “Alert Rules” tile to navigate to the “Alert Rules” blade, as shown below:
Clicking on the “Add Alert” button will open up the following “Add an Alert rule” blade, where you can create the Alert Rule. You can create the following types of “Alert rules”:,
- Rules based on Metrics
- Rules based on Events
For both the types, given above, we can provide a name and description, along with the following details:
- Condition
- Threshold
- Period on which the error or event has occurred
As shown below, for the sake of simplicity, I added a simple alert that sends me a notification when there are more than two requests in the last five minutes.
Click “OK” to view the new alert, as shown below:
Now, I created a few requests by browsing the Website and below are the E-mails, that I have received.
Subject: [ALERT ACTIVATED] - Requests GreaterThan 2 (Count) in the last 5 minutes.
Subject: [ALERT RESOLVED] - Requests GreaterThan 2 (Count) in the last 5 minutes.
Hope you enjoyed reading the article. Your feedback is highly appreciated.