You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ah, looking at the ARM docs for log search alerts I just realised that the alert builder in Farmer is actually building a Microsoft.Insights/metricAlerts resource, but log search alerts use the Microsoft.Insights/scheduledQueryRules resource which I don't think exists in Farmer yet. Just picking through the docs / source etc now trying to work out what is going on.
It has Serilog structured logging, OTel metric and Traces plus the search query alert for data limits.
I will hopefully find time to make a proper Farmer PR rather than using the JSON, I just need to re-familiarise myself with the code, it's been a while!
Activity
[-]`Query` property unavailable for custom log alerts[/-][+]`Query` property for custom log alerts[/+][-]`Query` property for custom log alerts[/-][+]Support Log Search Alerts[/+]Ryan-Palmer commentedon Dec 9, 2024
Ah, looking at the ARM docs for log search alerts I just realised that the alert builder in Farmer is actually building a
Microsoft.Insights/metricAlertsresource, but log search alerts use theMicrosoft.Insights/scheduledQueryRulesresource which I don't think exists in Farmer yet. Just picking through the docs / source etc now trying to work out what is going on.Metric alert (just 'alert' in Farmer) :
{ "type": "Microsoft.Insights/metricAlerts", "apiVersion": "2018-03-01", "name": "[parameters('alertName')]", "location": "global", "properties": { "description": "[parameters('alertDescription')]", "severity": "[parameters('alertSeverity')]", "enabled": "[parameters('isEnabled')]", "scopes": [ "[parameters('resourceId')]" ], "evaluationFrequency": "[parameters('evaluationFrequency')]", "windowSize": "[parameters('windowSize')]", "criteria": { "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", "allOf": [ { "name": "1st criterion", "metricName": "[parameters('metricName')]", "dimensions": [], "operator": "[parameters('operator')]", "threshold": "[parameters('threshold')]", "timeAggregation": "[parameters('timeAggregation')]", "criterionType": "StaticThresholdCriterion" } ] }, "actions": [ { "actionGroupId": "[parameters('actionGroupId')]" } ] } }Log alert (scheduledQueryRule, not in Farmer afaik):
{ "type": "Microsoft.Insights/scheduledQueryRules", "apiVersion": "2021-08-01", "name": "[parameters('alertName')]", "location": "[parameters('location')]", "tags": {}, "properties": { "description": "[parameters('alertDescription')]", "severity": "[parameters('alertSeverity')]", "enabled": "[parameters('isEnabled')]", "scopes": [ "[parameters('resourceId')]" ], "evaluationFrequency": "[parameters('evaluationFrequency')]", "windowSize": "[parameters('windowSize')]", "criteria": { "allOf": [ { "query": "[parameters('query')]", "metricMeasureColumn": "[parameters('metricMeasureColumn')]", "resourceIdColumn": "[parameters('resourceIdColumn')]", "dimensions": [], "operator": "[parameters('operator')]", "threshold": "[parameters('threshold')]", "timeAggregation": "[parameters('timeAggregation')]", "failingPeriods": { "numberOfEvaluationPeriods": "[parameters('numberOfEvaluationPeriods')]", "minFailingPeriodsToAlert": "[parameters('minFailingPeriodsToAlert')]" } } ] }, "muteActionsDuration": "[parameters('muteActionsDuration')]", "autoMitigate": "[parameters('autoMitigate')]", "checkWorkspaceAlertsStorageConfigured": "[parameters('checkWorkspaceAlertsStorageConfigured')]", "actions": { "actionGroups": [ "[parameters('actionGroupId')]" ], "customProperties": { "key1": "value1", "key2": "value2" } } } }Ryan-Palmer commentedon Dec 9, 2024
Did the quick hack test, got it working with the JSON builder
Ryan-Palmer commentedon Dec 17, 2024
Here's a complete working sample.
It has Serilog structured logging, OTel metric and Traces plus the search query alert for data limits.
I will hopefully find time to make a proper Farmer PR rather than using the JSON, I just need to re-familiarise myself with the code, it's been a while!
https://github.com/Ryan-Palmer/Safe-Serilog-Farmer-Demo