Send Azure activity log data - Azure Monitor (2024)

  • Article

The Azure Monitor activity log is a platform log that provides insight into subscription-level events. The activity log includes information like when a resource is modified or a virtual machine is started. You can view the activity log in the Azure portal or retrieve entries with PowerShell and the Azure CLI. This article provides information on how to view the activity log and send it to different destinations.

For more functionality, create a diagnostic setting to send the activity log to one or more of these locations for the following reasons:

  • Send to Azure Monitor Logs for more complex querying and alerting and for longer retention of up to 12 years.
  • Send to Azure Event Hubs to forward outside of Azure.
  • Send to Azure Storage for cheaper, long-term archiving.

For details on how to create a diagnostic setting, see Create diagnostic settings to send platform logs and metrics to different destinations.

Note

  • Entries in the Activity Log are system generated and can't be changed or deleted.
  • Entries in the Activity Log are representing control plane changes like a virtual machine restart, any non related entries should be written into Azure Resource Logs
  • Entries in the Activity Log are typically a result of changes (create, update or delete operations) or an action having been initiated. Operations focused on reading details of a resource are not typically captured.

Send to Log Analytics workspace

Send the activity log to a Log Analytics workspace to enable the Azure Monitor Logs feature, where you:

  • Correlate activity log data with other monitoring data collected by Azure Monitor.
  • Consolidate log entries from multiple Azure subscriptions and tenants into one location for analysis together.
  • Use log queries to perform complex analysis and gain deep insights on activity log entries.
  • Use log search alerts with Activity entries for more complex alerting logic.
  • Store activity log entries for longer than the activity log retention period.
  • Incur no data ingestion or retention charges for activity log data stored in a Log Analytics workspace.
  • The default retention period in Log Analytics is 90 days

Select Export Activity Logs to send the activity log to a Log Analytics workspace.

You can send the activity log from any single subscription to up to five workspaces.

Activity log data in a Log Analytics workspace is stored in a table called AzureActivity that you can retrieve with a log query in Log Analytics. The structure of this table varies depending on the category of the log entry. For a description of the table properties, see the Azure Monitor data reference.

For example, to view a count of activity log records for each category, use the following query:

AzureActivity| summarize count() by CategoryValue

To retrieve all records in the administrative category, use the following query:

AzureActivity| where CategoryValue == "Administrative"

Important

In some scenarios, it's possible that values in fields of AzureActivity might have different casings from otherwise equivalent values. Take care when querying data in AzureActivity to use case-insensitive operators for string comparisons, or use a scalar function to force a field to a uniform casing before any comparisons. For example, use the tolower() function on a field to force it to always be lowercase or the =~ operator when performing a string comparison.

Send to Azure Event Hubs

Send the activity log to Azure Event Hubs to send entries outside of Azure, for example, to a third-party SIEM or other log analytics solutions. Activity log events from event hubs are consumed in JSON format with a records element that contains the records in each payload. The schema depends on the category and is described in Azure activity log event schema.

The following sample output data is from event hubs for an activity log:

{ "records": [ { "time": "2019-01-21T22:14:26.9792776Z", "resourceId": "/subscriptions/s1/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841", "operationName": "microsoft.support/supporttickets/write", "category": "Write", "resultType": "Success", "resultSignature": "Succeeded.Created", "durationMs": 2826, "callerIpAddress": "111.111.111.11", "correlationId": "c776f9f4-36e5-4e0e-809b-c9b3c3fb62a8", "identity": { "authorization": { "scope": "/subscriptions/s1/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841", "action": "microsoft.support/supporttickets/write", "evidence": { "role": "Subscription Admin" } }, "claims": { "aud": "https://management.core.windows.net/", "iss": "https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/", "iat": "1421876371", "nbf": "1421876371", "exp": "1421880271", "ver": "1.0", "http://schemas.microsoft.com/identity/claims/tenantid": "00000000-0000-0000-0000-000000000000", "http://schemas.microsoft.com/claims/authnmethodsreferences": "pwd", "http://schemas.microsoft.com/identity/claims/objectidentifier": "2468adf0-8211-44e3-95xq-85137af64708", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": "[email protected]", "puid": "20030000801A118C", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": "9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": "John", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": "Smith", "name": "John Smith", "groups": "cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": " [email protected]", "appid": "c44b4083-3bq0-49c1-b47d-974e53cbdf3c", "appidacr": "2", "http://schemas.microsoft.com/identity/claims/scope": "user_impersonation", "http://schemas.microsoft.com/claims/authnclassreference": "1" } }, "level": "Information", "location": "global", "properties": { "statusCode": "Created", "serviceRequestId": "50d5cddb-8ca0-47ad-9b80-6cde2207f97c" } } ]}

Send to Azure Storage

Send the activity log to an Azure Storage account if you want to retain your log data longer than 90 days for audit, static analysis, or back up. If you're required to retain your events for 90 days or less, you don't need to set up archival to a storage account. Activity log events are retained in the Azure platform for 90 days.

When you send the activity log to Azure, a storage container is created in the storage account as soon as an event occurs. The blobs in the container use the following naming convention:

insights-activity-logs/resourceId=/SUBSCRIPTIONS/{subscription ID}/y={four-digit numeric year}/m={two-digit numeric month}/d={two-digit numeric day}/h={two-digit 24-hour clock hour}/m=00/PT1H.json

For example, a particular blob might have a name similar to:

insights-logs-networksecuritygrouprulecounter/resourceId=/SUBSCRIPTIONS/00000000-0000-0000-0000-000000000000/y=2020/m=06/d=08/h=18/m=00/PT1H.json

Each PT1H.json blob contains a JSON object with events from log files that were received during the hour specified in the blob URL. During the present hour, events are appended to the PT1H.json file as they're received, regardless of when they were generated. The minute value in the URL, m=00 is always 00 as blobs are created on a per hour basis.

Each event is stored in the PT1H.json file with the following format. This format uses a common top-level schema but is otherwise unique for each category, as described in Activity log schema.

{ "time": "2020-06-12T13:07:46.766Z", "resourceId": "/SUBSCRIPTIONS/00000000-0000-0000-0000-000000000000/RESOURCEGROUPS/MY-RESOURCE-GROUP/PROVIDERS/MICROSOFT.COMPUTE/VIRTUALMACHINES/MV-VM-01", "correlationId": "0f0cb6b4-804b-4129-b893-70aeeb63997e", "operationName": "Microsoft.Resourcehealth/healthevent/Updated/action", "level": "Information", "resultType": "Updated", "category": "ResourceHealth", "properties": {"eventCategory":"ResourceHealth","eventProperties":{"title":"This virtual machine is starting as requested by an authorized user or process. It will be online shortly.","details":"VirtualMachineStartInitiatedByControlPlane","currentHealthStatus":"Unknown","previousHealthStatus":"Unknown","type":"Downtime","cause":"UserInitiated"}}}

Other methods to retrieve activity log events

You can also access activity log events by using the following methods:

  • Use the Get-AzLog cmdlet to retrieve the activity log from PowerShell. See Azure Monitor PowerShell samples.
  • Use az monitor activity-log to retrieve the activity log from the CLI. See Azure Monitor CLI samples.
  • Use the Azure Monitor REST API to retrieve the activity log from a REST client.

Legacy collection methods

Note

  • Azure Activity logs solution was used to forward Activity Logs to Azure Log Analytics. This solution is being retired on the 15th of Sept 2026 and will be automatically converted to Diagnostic settings.

If you're collecting activity logs using the legacy collection method, we recommend you export activity logs to your Log Analytics workspace and disable the legacy collection using the Data Sources - Delete API as follows:

  1. List all data sources connected to the workspace using the Data Sources - List By Workspace API and filter for activity logs by setting kind eq 'AzureActivityLog'.

  2. Copy the name of the connection you want to disable from the API response.

  3. Use the Data Sources - Delete API to stop collecting activity logs for the specific resource.

Managing legacy Log Profiles - retiring

Note

  • Logs Profiles was used to forward Activity Logs to storage accounts and Event Hubs. This method is being retired on the 15th of Sept 2026.
  • If you are using this method, transition to Diagnostic Settings before 15th of Sept 2025, when we will stop allowing new creates of Log Profiles.

Log profiles are the legacy method for sending the activity log to storage or event hubs. If you're using this method, transition to Diagnostic Settings, which provide better functionality and consistency with resource logs.

  • PowerShell
  • CLI

If a log profile already exists, you first must remove the existing log profile, and then create a new one.

  1. Use Get-AzLogProfile to identify if a log profile exists. If a log profile exists, note the Name property.

  2. Use Remove-AzLogProfile to remove the log profile by using the value from the Name property.

    # For example, if the log profile name is 'default'Remove-AzLogProfile -Name "default"
  3. Use Add-AzLogProfile to create a new log profile:

    Add-AzLogProfile -Name my_log_profile -StorageAccountId /subscriptions/s1/resourceGroups/myrg1/providers/Microsoft.Storage/storageAccounts/my_storage -serviceBusRuleId /subscriptions/s1/resourceGroups/Default-ServiceBus-EastUS/providers/Microsoft.ServiceBus/namespaces/mytestSB/authorizationrules/RootManageSharedAccessKey -Location global,westus,eastus -RetentionInDays 90 -Category Write,Delete,Action
    PropertyRequiredDescription
    NameYesName of your log profile.
    StorageAccountIdNoResource ID of the storage account where the activity log should be saved.
    serviceBusRuleIdNoService Bus Rule ID for the Service Bus namespace where you want to have event hubs created. This string has the format {service bus resource ID}/authorizationrules/{key name}.
    LocationYesComma-separated list of regions for which you want to collect activity log events.
    RetentionInDaysYesNumber of days for which events should be retained in the storage account, from 1 through 365. A value of zero stores the logs indefinitely.
    CategoryNoComma-separated list of event categories to be collected. Possible values are Write, Delete, and Action.

Example script

This sample PowerShell script creates a log profile that writes the activity log to both a storage account and an event hub.

# Settings needed for the new log profile$logProfileName = "default"$locations = (Get-AzLocation).Location$locations += "global"$subscriptionId = "<your Azure subscription Id>"$resourceGroupName = "<resource group name your Event Hub belongs to>"$eventHubNamespace = "<Event Hub namespace>"# Build the service bus rule Id from the settings above$serviceBusRuleId = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.EventHub/namespaces/$eventHubNamespace/authorizationrules/RootManageSharedAccessKey"# Build the Storage Account Id from the settings above$storageAccountId = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Storage/storageAccounts/$storageAccountName"Add-AzLogProfile -Name $logProfileName -Location $locations -StorageAccountId $storageAccountId -ServiceBusRuleId $serviceBusRuleId

Data structure changes

The Export activity logs experience sends the same data as the legacy method used to send the activity log with some changes to the structure of the AzureActivity table.

The columns in the following table have been deprecated in the updated schema. They still exist in AzureActivity, but they have no data. The replacements for these columns aren't new, but they contain the same data as the deprecated column. They're in a different format, so you might need to modify log queries that use them.

Activity log JSONLog Analytics column name
(older deprecated)
New Log Analytics column nameNotes
categoryCategoryCategoryValue
status

Values are success, start, accept, failure

ActivityStatus

Values same as JSON

ActivityStatusValue

Values change to succeeded, started, accepted, failed

The valid values change as shown.
subStatusActivitySubstatusActivitySubstatusValue
operationNameOperationNameOperationNameValueREST API localizes the operation name value. Log Analytics UI always shows English.
resourceProviderNameResourceProviderResourceProviderValue

Important

In some cases, the values in these columns might be all uppercase. If you have a query that includes these columns, use the =~ operator to do a case-insensitive comparison.

The following columns have been added to AzureActivity in the updated schema:

  • Authorization_d
  • Claims_d
  • Properties_d

Next steps

Learn more about:

  • Platform logs
  • Activity log event schema
  • Activity log insights
Send Azure activity log data - Azure Monitor (2024)

FAQs

How do I export logs from Azure Monitor? ›

On the Log Analytics workspace menu in the Azure portal, select Data Export under the Settings section. Select the Status toggle to disable or enable the export rule.

How do I send Azure activity logs to Log Analytics? ›

Under Destination Details select the Send to Log Analytics workspace check box. Select the appropriate Subscription and Log Analytics workspace from the menus. Select the Save button. If you don't see logs appearing in the selected destination after 15 minutes, sign out and back into Azure to refresh the logs.

How do I send logs to an Azure Monitor? ›

Create new table in Log Analytics workspace
  1. Go to the Log Analytics workspaces menu in the Azure portal and select Tables. ...
  2. Specify a name for the table. ...
  3. Select Create a new data collection rule to create the DCR that will be used to send data to this table. ...
  4. Select the DCR that you created, and then select Next.
Jan 2, 2024

What is the difference between Azure Monitor and Azure logs? ›

Azure Monitor Metrics can only store numeric data in a particular structure, whereas Azure Monitor Logs can store a variety of data types that have their own structures. You can also perform complex analysis on Azure Monitor Logs data by using log queries, which can't be used for analysis of Azure Monitor Metrics data.

Where logs are stored in Azure Monitor? ›

Logs in Azure Monitor are stored in a Log Analytics workspace that's based on Azure Data Explorer, which provides a powerful analysis engine and rich query language.

What is the difference between resource log and activity log in Azure? ›

Resource logs/Diagnostic Logs capture activity to the data access plane while the Activity log is a subscription-level log for the control plane. Resource-level diagnostic logs provide insight into operations that were performed within that resource itself.

How do I Monitor user activity? ›

There are various methods implemented to monitor and manage user activity such as:
  1. Video recordings of sessions.
  2. Log collection and analysis.
  3. Network packet inspection.
  4. Keystroke logging.
  5. Kernel monitoring.
  6. File/screenshot capturing.
May 6, 2023

How do I Monitor Azure function logs? ›

To view a near real time stream of application log files generated by your function running in Azure, you can connect to Application Insights and use Live Metrics Stream. Or, you can use the App Service platform built-in log streaming to view a stream of application log files.

How to push data to Azure Log Analytics? ›

Create data collection endpoint

A DCE is required to accept the data being sent to Azure Monitor. After you configure the DCE and link it to a DCR, you can send data over HTTP from your application. The DCE must be located in the same region as the DCR and the Log Analytics workspace where the data will be sent.

How do I send Azure AD audit logs to Log Analytics? ›

On the Diagnostic setting page, perform the following steps:
  1. Under Category details, select AuditLogs and SigninLogs.
  2. Under Destination details, select Send to Log Analytics, and then select your new log analytics workspace.
  3. Select Save.
Feb 9, 2024

How do you access data collected by an Azure Monitor? ›

The Log Analytics user interface in the Azure portal helps you query the log data collected by Azure Monitor so that you can quickly retrieve, consolidate, and analyze collected data.

How do I send Azure Monitor logs to Sentinel? ›

After logging in to Microsoft Azure, navigate to Microsoft Sentinel and select the Workspace that will receive the forwarded security events. Under the General heading immediately below Overview click Logs, which will open up the following Azure Queries modal. Close this modal.

What is Azure Monitor Log Analytics? ›

Log Analytics is a tool in the Azure portal to edit and run log queries from data collected by Azure Monitor logs and interactively analyze their results. You can use Log Analytics queries to retrieve records that match particular criteria, identify trends, analyze patterns, and provide various insights into your data.

How do I send Azure logs to event hub? ›

Select the log categories that you want to stream.
  1. Select the Stream to an event hub check box.
  2. Select the Azure subscription, Event Hubs namespace, and optional event hub where you want to route the logs.
Jan 23, 2024

How do I get logs from Process Monitor? ›

Create a boot log
  1. Download Process Monitor, then extract the file ProcessMonitor. ...
  2. To start logging, double-click Procmon.exe to run the tool.
  3. Select Options > Enable Boot Logging.
  4. Click OK.
  5. Restart the computer. ...
  6. Once Windows has finished loading, double-click Procmon.exe.
  7. To save the log file, click Yes.
Mar 1, 2024

How do I export logs? ›

How to export event viewer logs?
  1. Open Event Viewer (Run → eventvwr. ...
  2. Locate the log to be exported.
  3. Select the logs that you want to export, right-click on them and select "Save All Events As".
  4. Enter a file name that includes the log type and the server it was exported from.
  5. Save as a CSV (Comma Separated Value) file.

How do I get all the logs from Azure function? ›

Azure Functions writes all logs to the FunctionAppLogs table under LogManagement in the Log Analytics workspace where you send the data. You can use Kusto queries to query the data.

How do I collect logs from Azure? ›

Use a log query to retrieve logs

Data is retrieved from a Log Analytics workspace by using a log query written in Kusto Query Language (KQL). A set of pre-created queries is available for many Azure services, so you don't require knowledge of KQL to get started. Select Logs from your resource's menu.

Top Articles
How to Change Legacy to UEFI without Reinstalling Windows 11, 10, 8, 7
Life is Full of Gambling — Steemit
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
Things To Do In Atlanta Tomorrow Night
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Dmv In Anoka
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Tish Haag

Last Updated:

Views: 6819

Rating: 4.7 / 5 (47 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Tish Haag

Birthday: 1999-11-18

Address: 30256 Tara Expressway, Kutchburgh, VT 92892-0078

Phone: +4215847628708

Job: Internal Consulting Engineer

Hobby: Roller skating, Roller skating, Kayaking, Flying, Graffiti, Ghost hunting, scrapbook

Introduction: My name is Tish Haag, I am a excited, delightful, curious, beautiful, agreeable, enchanting, fancy person who loves writing and wants to share my knowledge and understanding with you.