Microsoft Log Analytics Query
Runs and ingests custom queries from Azure Log Analytics to collect operational or identity-related logs
Sync Type: Incremental
Requirements
Before setting up the Microsoft Log Analytics Query you need to:
- Have a Microsoft Account with an active Azure Subscription
- Create an app registration with a client secret
- Assign the application the Log Analytics Reader (or Reader) role on the Log Analytics workspace
Note: On the first sync, the start time is determined in order: Backfill Start Time if set, otherwise now - Ingestion Delay if configured, otherwise starts from current time (while accounting for the ingestion delay in azure). Subsequent syncs are incremental from the last successful sync time.
Query behavior: Monad automatically appends | extend IngestionTime = ingestion_time() and filters/sorts by IngestionTime rather than TimeGenerated.
Monad appends ingestion-time filtering, sorting and a 1,000-row limit to your query, so your query must return table rows.
Don't use summarize, don't project away columns, and don't include take, limit, sort or order by in your query.
Ingestion Delay: Because the input already tracks ingestion time, events that arrive late are not missed.
Ingestion Delay only needs to cover the time between a record's ingestion and it becoming queryable, which is typically a few minutes.
You don't need to measure the delay between TimeGenerated and ingestion with the percentile query in the setting's description.
Configuration
Settings
| Setting | Type | Required | Default | Description |
|---|---|---|---|---|
tenant_id | string | Yes | - | The tenant ID of the Entra ID directory associated with your Azure subscription. |
workspace_id | string | Yes | - | The workspace ID of the Log Analytics workspace |
query | string | Yes | - | The KQL query to run against the Log Analytics workspace. Do not include IngestionTime filters, sorting, or limits since these are managed automatically. |
ingestion_delay | int | No | 0 | How far behind real time (in seconds) each sync reads, so rows Azure has ingested but not yet made queryable are not missed. The input tracks ingestion time, so late-arriving events are collected anyway; a few minutes is usually enough. |
backfill_start_time | date | No | - | The date to start fetching data from. If not specified, no past records will be fetched. |
use_synthetic_data | bool | No | false | Generate synthetic data for testing, instead of connecting to a real data source. Defaults to an hourly cron schedule for cron-based inputs. |
rate_limit | object | No | - | Maximum outbound source-API request rate. A blank or zero value falls back to the connector's default rate-limiting behavior. Maximum 10 requests per second. See API Rate Limiting for the field format. |
Secrets
| Secret | Type | Required | Description |
|---|---|---|---|
client_id | secret | Yes | The client ID of the Entra ID application |
client_secret | secret | Yes | The client secret of the Entra ID application |
Setting up API Access
- Registering a new application
- Open the App Registration page in the Azure portal.
- Select New Registration
- Add a name to the new registration
- Click Register
- Save the applications
Application (client) IDandDirectory (tenant) ID - Select Certificates and Secrets
- Click link next to Client credentials
- In "Client secrets" click "New client secret"
- Add a name and expiration to the new secret
- Save the client secret value
- Grant access to your Log Analytics Workspace
- Navigate to the Log Analytics Workspace
- Select the workspace
- Click "Access control (IAM)" on the left menu
- Select "Add Role Assignment" from the "+ Add" menu
- Select the
Log Analytics Reader(orReader) role and click Next - Click "Select members"
- Search for the new application name and click Select
- Click "Review + assign"
- Confirm by clicking "Review + assign"
Related Articles
Sample Record
Code
Sync frequency
By default this input polls approximately every 10 seconds, with each sync beginning after the previous one completes. A cron schedule configured on the pipeline overrides this cadence. See Input Sync Frequency for details.