Export Lovable logs to Azure Log Analytics
You can send your Lovable activity records to Azure Log Analytics for detailed tracking and analysis. This involves setting up a connection in Lovable and running a script in Azure to create the necessary storage and access rules.
Anyone on an Enterprise plan who wants to keep a record of their Lovable activity in Azure Log Analytics needs this.
Do this, in order
- 1
Go to 'Data exports' in Lovable settings, click 'New data export', choose 'Azure Log Analytics' as the destination, and select the 'Source' of logs you want to export.
This starts the export setup process and tells Lovable which type of data you want to send to Azure.
- 2
In the Azure portal, create a new app registration in 'Microsoft Entra ID' and copy its 'Directory (tenant) ID' and 'Application (client) ID' into the corresponding fields in Lovable.
This creates a secure identity in Azure that Lovable will use to connect without needing to store passwords.
- 3
On the app registration in Azure, go to 'Certificates & secrets' > 'Federated credentials' and add a new credential using the 'Other issuer' scenario, filling in the values provided in Lovable's setup panel.
This tells Azure that Lovable is a trusted service allowed to use this app identity.
- 4
In Azure, find your Log Analytics workspace's 'Resource ID' on its 'Properties' page and paste it into the 'Log Analytics workspace resource ID' field in Lovable.
This tells Lovable exactly where in Azure to send your logs.
- 5
Copy the 'Azure CLI script' from Lovable's setup panel and run it in your Azure CLI.
This script automatically creates the specific storage table and rules in Azure, and grants the necessary permissions for Lovable to send data.
- 6
Click 'Test connection' in Lovable.
This verifies that Lovable can successfully connect to your Azure setup and has the right permissions before any data is actually sent.
- 7
Click 'Create export' in Lovable.
This finalizes the setup and starts the scheduled export of your Lovable logs to Azure.
Paste this into your project
Hey Lovable, I need to set up a scheduled export of my audit logs to Azure Log Analytics. Can you guide me through the steps to connect to my Azure workspace and ensure all the necessary tables and permissions are configured? I'm on an Enterprise plan.
Words decoded
- Azure Log Analytics workspace
- A dedicated space in Microsoft Azure where you can collect, store, and analyze data from various sources, including your Lovable logs.
- Microsoft Entra ID
- Microsoft's cloud-based identity and access management service, used here to create a secure identity for Lovable to connect to Azure.
- App registration
- A record in Microsoft Entra ID that represents an application (like Lovable) and defines its permissions and how it can securely interact with Azure services.
- Federated credential
- A secure way for an external service (like Lovable) to authenticate with Azure using its own identity system, without needing to store passwords or secret keys in Azure.
- Data collection rule
- A set of instructions in Azure that defines what data to collect, how to transform it, and where to send it within Log Analytics.
- Azure CLI
- A command-line tool that lets you manage Azure resources using text commands, often used for automation.
- Resource ID
- A unique identifier for any resource (like a Log Analytics workspace) within Azure, specifying its subscription, resource group, and name.
Where people get stuck
- Using an Azure Log Analytics workspace outside the Azure public cloud (e.g., Government, China) or with private endpoints, as these are not supported.
- Not having the correct permissions in Microsoft Entra ID to register an app or add a federated credential.
- Not having the correct permissions in Azure to create tables, data collection rules, custom roles, and role assignments in the workspace's resource group.
- Trying to change the tenant ID, client ID, or workspace resource ID of an existing export; you must create a new export instead.
- Deleting the table or data collection rule in Azure without first disabling or deleting the export in Lovable, which will cause runs to fail until the setup script is re-run.
- Expecting Lovable to read back or guarantee full field values if Azure truncates them due to size limits (64 KB for individual fields, 1 MB for total request).
- Not running the specific Azure CLI script provided in Lovable's setup panel, as it is the source of truth for permissions and credential values.
The short version, steps, decoder and prompt on this page are written automatically from Lovable's own documentation and can lag or misread it. The official page is always the authority.