Activity Log

Source code & Installation

The source code of this kit module can be found hereopen in new window

Run the following command to install the kit module:

collie kit import azure/activity-log
1

Getting started with log analytics workspace

If you have not done so already, move an existing subscription into the management group hierarchy and check the policy assignment status in Azure Portal. We expect to see that the scope is compliant with the policy.

Here is how you interact with logs in your new workspace.

Open log analytics workspace in Azure portal. Choose the newly created workspace. Choose Workbooks → Activity Logs Insights. You will see stats about the Activity Logs streamed from the connected subscriptions to the log analytics workspace.

This assumes that in some Activity Log items has been generated in any of the

Alternatively, you can query logs. To do so, choose Logs in your workspace.

Here is a query that displays the last 50 Activity log events:

// Display top 50 Activity log events.
AzureActivity
| project TimeGenerated, SubscriptionId, ResourceGroup,ResourceProviderValue,OperationNameValue,CategoryValue,CorrelationId,ActivityStatusValue, ActivitySubstatusValue, Properties_d, Caller
| top 50 by TimeGenerated
1
2
3
4

Requirements

NameVersion
terraform>= 1.0
azurerm~> 3.71.0

Modules

NameSourceVersion
policy_lawgithub.com/meshcloud/collie-hub//kit/azure/util/azure-policiesef06c8d43611dd3bf6eebdd7f472b95472f86b0b

Resources

NameType
azurerm_log_analytics_workspace.lawopen in new windowresource
azurerm_resource_group.law_rgopen in new windowresource
azurerm_role_assignment.activity_logopen in new windowresource
azurerm_role_assignment.cloudfoundation_tfdeployopen in new windowresource
azurerm_role_definition.cloudfoundation_tfdeployopen in new windowresource
azurerm_subscription.currentopen in new windowdata source

Inputs

NameDescriptionTypeDefaultRequired
cloudfoundationthis is the name of your cloud-foundationstringn/ayes
cloudfoundation_deploy_principal_idservice principal idstringn/ayes
locationlocation of the resourcesstringn/ayes
log_retention_in_daysamount of time of log retentionnumber30no
scopeid of the management group that you want to logstringn/ayes

Outputs

NameDescription
documentation_mdn/a