Review Activity Log retention

Retain Activity Logs for the required investigation and audit period, and check destination policies.

Description

Subscription Activity Log records are available for 90 days by default. To trace resource deletions or permission changes beyond that window, export the required categories through subscription diagnostic settings.

Potential impact

A later audit or incident investigation can miss management operations that were never exported or expired early at the destination.

Remediation

Choose a period based on investigation needs, contractual or regulatory obligations and cost. Set Log Analytics retention or a Storage lifecycle policy, then use the investigator’s permissions to retrieve the oldest records available and a recent change.

Examples

September 30, 2026 was the scheduled retirement date for Log Profiles. AzureRM 4 removed azurerm_monitor_log_profile. These historical excerpts omit required categories, locations and destinations.

Before

hcl
resource "azurerm_monitor_log_profile" "example" {
  name = "default"

  retention_policy {
    enabled = true
    days    = 7
  }
}

Seven days falls short for an organization that needs a 365-day history.

After

hcl
resource "azurerm_monitor_log_profile" "example" {
  name = "default"

  retention_policy {
    enabled = true
    days    = 367
  }
}

The second policy specifies 367 days. A shorter deletion policy at the destination can still remove records earlier.

References