Skip to content

Commit

Permalink
Add logs to Log Analytics for Grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
albal committed Feb 13, 2024
1 parent cd5a67d commit 1b2e22a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Terraform/grafana-log.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
resource "azurerm_monitor_diagnostic_setting" "grafana-diagnostics" {
name = var.gf_diag_name[terraform.workspace]
target_resource_id = azurerm_linux_web_app.grafana-web-app.id
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.log-analytics-ws.id

metric {
category = "AllMetrics"
enabled = true
}

enabled_log {
category = "HTTPLogs"
}

enabled_log {
category = "AppServiceConsoleLogs"
}

enabled_log {
category = "AppServiceAppLogs"
}
}
12 changes: 12 additions & 0 deletions Terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,18 @@ variable "fw_diag_name" {
description = "Firewall Diagnostic Name"
}

variable "gf_diag_name" {
type = map(string)
default = {
Dev = "s185d01-grafana-diagnostics"
Test = "s185d02-grafana-diagnostics"
Load-Test = "s185d03-grafana-diagnostics"
Pre-Prod = "s185t01-grafana-diagnostics"
Prod = "s185p01-grafana-diagnostics"
}
description = "Grafana Diagnostic Name"
}

variable "fwpol_name" {
type = map(string)
default = {
Expand Down

0 comments on commit 1b2e22a

Please sign in to comment.