Skip to content

Commit

Permalink
split out live and pre-live queries (#253)
Browse files Browse the repository at this point in the history
Co-authored-by: jcrichlake <[email protected]>
  • Loading branch information
somesylvie and jcrichlake authored Dec 17, 2024
1 parent 8b01ae8 commit 679441c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions operations/template/logs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,24 @@ resource "azurerm_log_analytics_query_pack" "application_logs_pack" {
}
}

resource "azurerm_log_analytics_query_pack_query" "structured_application_logs" {
display_name = "RS SFTP's Raw Application Logs"
description = "View all RS SFTP's application logs in a structured format"
resource "azurerm_log_analytics_query_pack_query" "live_structured_application_logs" {
display_name = "RS SFTP's Live Slot Raw Application Logs"
description = "View RS SFTP's live slot application logs in a structured format"

query_pack_id = azurerm_log_analytics_query_pack.application_logs_pack.id
categories = ["applications"]

body = "AppServiceConsoleLogs | project JsonResult = parse_json(ResultDescription) | evaluate bag_unpack(JsonResult) | project-reorder ['time'], level, msg"
body = "AppServiceConsoleLogs | where _ResourceId !contains 'pre-live' | project JsonResult = parse_json(ResultDescription) | evaluate bag_unpack(JsonResult) | project-reorder ['time'], level, msg"
}

resource "azurerm_log_analytics_query_pack_query" "prelive_structured_application_logs" {
display_name = "RS SFTP's Pre-Live Slot Raw Application Logs"
description = "View RS SFTP's pre-live slot application logs in a structured format"

query_pack_id = azurerm_log_analytics_query_pack.application_logs_pack.id
categories = ["applications"]

body = "AppServiceConsoleLogs | where _ResourceId contains 'pre-live' | project JsonResult = parse_json(ResultDescription) | evaluate bag_unpack(JsonResult) | project-reorder ['time'], level, msg"
}

resource "azurerm_monitor_diagnostic_setting" "app_to_logs" {
Expand Down

0 comments on commit 679441c

Please sign in to comment.