azure-monitor-ingestion-py

Solid

Azure Monitor Ingestion SDK for Python. Use for sending custom logs to Log Analytics workspace via Logs Ingestion API. Triggers: "azure-monitor-ingestion", "LogsIngestionClient", "custom logs", "DCR", "data collection rule", "Log Analytics".

DevOps & Infrastructure 2,418 stars 270 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 96/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Azure Monitor Ingestion SDK for Python Send custom logs to Azure Monitor Log Analytics workspace using the Logs Ingestion API. ## Installation ```bash pip install azure-monitor-ingestion pip install azure-identity ``` ## Environment Variables ```bash # Data Collection Endpoint (DCE) AZURE_DCE_ENDPOINT=https://<dce-name>.<region>.ingest.monitor.azure.com # Data Collection Rule (DCR) immutable ID AZURE_DCR_RULE_ID=dcr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Stream name from DCR AZURE_DCR_STREAM_NAME=Custom-MyTable_CL ``` ## Prerequisites Before using this SDK, you need: 1. **Log Analytics Workspace** — Target for your logs 2. **Data Collection Endpoint (DCE)** — Ingestion endpoint 3. **Data Collection Rule (DCR)** — Defines schema and destination 4. **Custom Table** — In Log Analytics (created via DCR or manually) ## Authentication ```python from azure.monitor.ingestion import LogsIngestionClient from azure.identity import DefaultAzureCredential import os client = LogsIngestionClient( endpoint=os.environ["AZURE_DCE_ENDPOINT"], credential=DefaultAzureCredential() ) ``` ## Upload Custom Logs ```python from azure.monitor.ingestion import LogsIngestionClient from azure.identity import DefaultAzureCredential import os client = LogsIngestionClient( endpoint=os.environ["AZURE_DCE_ENDPOINT"], credential=DefaultAzureCredential() ) rule_id = os.environ["AZURE_DCR_RULE_ID"] stream_name = os.environ["AZURE_DCR_STREAM_NAME"] logs = [ {"TimeGenerated": "202...

Details

Author
microsoft
Repository
microsoft/skills
Created
4 months ago
Last Updated
yesterday
Language
TypeScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category