Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Log Analytics #548

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion infra/terraform/cosmosdb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "azurerm_cosmosdb_account" "db_account" {
offer_type = "Standard"
kind = "MongoDB"

enable_automatic_failover = true
automatic_failover_enabled = true

capabilities { # forces replacement
name = "EnableMongo"
Expand Down
22 changes: 22 additions & 0 deletions infra/terraform/log-analytics.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
resource "azurerm_log_analytics_workspace" "gratibot" {
name = "gratibot-${var.environment}"
location = var.location
resource_group_name = var.resource_group_name
sku = "PerGB2018"
retention_in_days = 30
daily_quota_gb = 0.5
}

resource "azurerm_monitor_diagnostic_setting" "gratibot-logs" {
name = "gratibot-logs"
target_resource_id = azurerm_linux_web_app.gratibot_app_service.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.gratibot.id

enabled_log {
category = "AppServiceConsoleLogs"
}
metric {
category = "AllMetrics"
enabled = false
}
}
2 changes: 1 addition & 1 deletion infra/terraform/vault.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ resource "azurerm_role_assignment" "gratibot" {

resource "azurerm_key_vault_secret" "mongo_connection_string" {
name = "mongo-connection-string"
value = azurerm_cosmosdb_account.db_account.connection_strings[0]
value = azurerm_cosmosdb_account.db_account.primary_mongodb_connection_string
key_vault_id = data.azurerm_key_vault.gratibot.id
}

Expand Down
Loading