How do you create an alert for when an Azure Function on the Consumption plan has timed out after 10 minutes? There used to be a signal in Application Insights called "Failures" that indicated this but it looks like Microsoft removed it. My old signal was whenever the total count of Failures was > 0 it would send me an email, but I don't see anything comparable anymore.
Open your application insights, click on Alerts and Click on Create alert.
There you can select Custom Log Search in condition as below:
Then you use the below query:
requests
| where duration > 1000
Then you can create alert over there, This is one way of getting alerts using Time Duration.
Related
I have created an Alert Rule in Event Grid for Dropped Events, alert works fine and I get the email, but neither in the Alert email or when I go and look at it in the Azure portal it shows me the actual error, like which subscription(s) had the failure and the error text (in my case I actually stopped one of the Functions that was subscribing one of the events to test the Alert)
In the Diagnostic Settings of Event Grid, I have set the logs to be sent to Log Analytics workspace but even after this I see no logs for the corresponding failures, am I missing anything? Is there an easy way to see the logs against a particular Alert?
Azure alerts proactively notify you when important conditions are found in your monitoring data. Log alerts allow users to use a Log Analytics query to evaluate resources logs every set frequency, and fire an alert based on the results.
You can search for the functions app logs under log analytics, check this Monitoring Azure Functions with Azure Monitor Logs documentation for the steps to do it.
Azure monitor processes terabytes of customer's log from across the world, which can also cause logs ingestion latency. It can be solved by optimizing the log alert queries.
Topic.
I want to setup an alert when someone on my team updates a configuration in a function app. I could not find this in the docs. Is this possible?
have a look at the Azure App Service as an Event Grid source
you can use an azure portal to subscribe for the eventType Microsoft.Web.AppUpdated and handle this event message in your properly subscriber, for instance: send the email, etc.
Azure Portal is down so can not provide more detailed answer right now. Will try to update it later.
You can "create log alert" if you're able to find a log message in Application Insights. You'll have to setup Function to send logs to Log Analytics.
Something like:
Go to your Function's logs (Logs at left bottom in Portal or your Log Analytics Workspace).
Find the right table that has Function App Activity events/logs.
Write appropriate query.
Click on Create Alert button above the query editor and follow steps.
If you've configured it to run say every 30 mins over last 30 min window, then Azure will just run that query on your logs every 30 minutes and if there are any hits (or not, depends on your alert configuration) it'll create an alert.
If the configuration of an AppService (or Function App) is changed, an event is created in the Activity Log.
You can send these logs to Log Analytics and create an alert based on the entries.
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log
Send the Activity log to a Log Analytics workspace to enable the features of Azure Monitor Logs which includes the following:
...
Use log alerts with Activity entries allowing for more complex alerting logic.
Im trying to setup health check alerts for critical functionality across my site. So for things like registrations, payments and critical emails I have started logging custom event telemetry using the telemetry client like so:
var tc = new TelemetryClient();
tc.TrackEvent(emailType.ToString());
This is currently working great and im able to create an Application Insights analytics dashboard out of this data, which form the basis of my alerts.
From the portal i have now started creating alerts on which the criteria is a custom log search (Azure Portal > Application Insights > Alerts > Add New Rule > Add Criteria), shown below:
The problem is the period has a max length of 24 hours which means for an event that fires in-frequently (lets say once over the cource of a week). We would get false alerts on a daily basis.
Question is how can I setup alerting in application insights for events like these?
I prefer if the solution does not require additional webjobs or code crunching numbers to figure out if thresholds are not met, as i feel an alerting system should have as little moving parts as possible.
Update 1
After having contacted Microsoft's alert feedback group they have extended the period dropdown to 48 Hours, however this is still inadequate for my usecase.
I have tried seeking alternative tools like Grafana (with and app insights plugins). However sadly that particular plugin does not support alerting (whilst Grafana does).
Is there a way to monitor the number of times a runbook has been called and then report on it (send email, text)? When I try to create an alert rule I only see an option for activity log not metrics. The runbook is getting called from event grid via webhook.
You can use automation runbooks with three alert types:
Classic metric alerts - Sends a notification when any platform-level metric meets a specific condition. For example, when the value for CPU % on a VM is greater than 90 for the past 5 minutes.
Activity log alerts
Near real-time metric alerts - Sends a notification faster than metric alerts when one or more platform-level metrics meet specified conditions. For example, when the value for CPU % on a VM is greater than 90, and the value for Network In is greater than 500 MB for the past 5 minutes.
When an alert calls a runbook, the actual call is an HTTP POST request to the webhook. The body of the POST request contains a JSON-formated object that has useful properties that are related to the alert.
This Microsoft documentation link might help for metrics alerts for runbook :
https://learn.microsoft.com/en-us/azure/automation/automation-create-alert-triggered-runbook
You can send your Azure Automation runbook status data to Log Analytics. From there, you can alert on the different states. This documentation should help you with this process: https://azure.microsoft.com/en-us/updates/send-your-runbook-job-status-and-job-streams-from-automation-to-log-analytics-oms/
There are multiple answers to this question although none of them are a perfect solution. What I ended up doing was putting a logic app in front of the runbook that then calls the runbook. This allows me to alert on the metrics of my logic app.
We have just added support for Monitoring runbooks and having Alerts on it. Please go to the Alerts experience in Azure Monitor where you should be able to choose an Automation Account and then a Runbook as a dimension and then perform actions based on number of jobs of the Runbook etc.
I've recently been playing around with the Bing's image search api, however I have a concern I hope to resolve.
It is to do with the limit on the number of api requests that are allowed per month. After doing some reading it seems like if I were to exceed this limit, my Azure account would be billed depending on the number of api calls I have gone over my limit. Is it possible to set up some kind of alert through the Azure management portal that will stop the api from processing any more calls once a specific threshold has been passed?
If anyone has any experience using the Search api and can enlighten me, that would be great.
Try Metrics Monitoring. Go to the service within Azure Portal, Scroll Down to Monitoring -> Metrics and then click Add Metric Alert.
You can create an alert based on the number of successful calls or total calls and the alert can notify you via e-mail. Additionally, if you want to take action automatically after reaching the threshold, you can use Webhooks to make a call out to a web application or Azure Automation Runbook to automatically run PowerShell scripts or some code to prevent overuse. You can also use Logic Apps for that. Check the following link for further details and examples at the end of the page:
https://learn.microsoft.com/en-us/azure/monitoring-and-diagnostics/insights-webhooks-alerts