Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

is there a way to create alerts for virtual machine, storage account resources in azure log analytics using terraform

”’
This is the approach i followed to create the alerts at resource level ( storage account).I am looking to create the alerts for different resources in log analytics instead of creating at resource level
”’

data "azurerm_storage_account" "stro" {
  name                = "straccount18"
  resource_group_name = azurerm_resource_group.rg.name
}

resource "azurerm_monitor_metric_alert" "AlertForLog" {
  name                = "metricalert"
  resource_group_name = azurerm_resource_group.rg.name
  scopes              = [data.azurerm_storage_account.stro.id]
  description         = "Alert generation demo"

  window_size         = "PT1H"
  severity = 0

  criteria {
    metric_namespace = "Microsoft.Storage/storageAccounts"
    metric_name      = "UsedCapacity"
    aggregation      = "Average"
    operator         = "GreaterThan"
    threshold        = 85
  }

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can do it by setting up query rules alerts as described in here https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert and enabling Storage Analytics as described in here

Query Storage Analytics Logs in Log Analytics: https://azure.microsoft.com/fr-fr/blog/query-azure-storage-analytics-logs-in-azure-log-analytics/

Sotage Analytics: https://docs.microsoft.com/en-us/azure/storage/common/storage-analytics

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading