Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save easonlai/fe8f55e209f64b6e8ea36384f3e2ffde to your computer and use it in GitHub Desktop.
Save easonlai/fe8f55e209f64b6e8ea36384f3e2ffde to your computer and use it in GitHub Desktop.
# Define the variables
$log_Analytics_Workspace_Resource_Group_Name = 'PLEASE_ENTER_YOUR_OWNED_LOG_ANALYTICS_WORKSPACE_RESOURCE_GROUP_NAME'
$log_Analytics_Workspace_Name = 'PLEASE_ENTER_YOUR_OWNED_LOG_ANALYTICS_WORKSPACE_NAME'
$log_Analytics_Export_Rule_Name = 'PLEASE_ENTER_RULE_NAME_TO_BE_CREATE'
$storageAccountResourceId = 'PLEASE_ENTER_YOUR_OWNED_BLOB_STORAGE_RESOURCE_PROPERTIES'
# Create new rule for Log Analytics export Container Insight and AKS related logs into Blob Storage
az monitor log-analytics workspace data-export create --resource-group $log_Analytics_Workspace_Resource_Group_Name --workspace-name $log_Analytics_Workspace_Name --name dnilaw01tostore01 --tables Heartbeat ContainerInventory ContainerImageInventory ContainerLog ContainerLogV2 ContainerNodeInventory ContainerServiceLog KubeEvents KubeHealth KubeMonAgentEvents KubeNodeInventory KubePodInventory KubeServices --destination $storageAccountResourceId
# Check newly created export rule
az monitor log-analytics workspace data-export show --resource-group $log_Analytics_Workspace_Resource_Group_Name --workspace-name $log_Analytics_Workspace_Name --name $log_Analytics_Export_Rule_Name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment