{"id":"f0aefdbc-b6ac-42cd-8e6b-4d066944af2a","shortId":"bMjtwn","kind":"skill","title":"azure-monitor-ingestion-py","tagline":"Azure Monitor Ingestion SDK for Python. Use for sending custom logs to Log Analytics workspace via Logs Ingestion API.","description":"# Azure Monitor Ingestion SDK for Python\n\nSend custom logs to Azure Monitor Log Analytics workspace using the Logs Ingestion API.\n\n## Installation\n\n```bash\npip install azure-monitor-ingestion\npip install azure-identity\n```\n\n## Environment Variables\n\n```bash\n# Data Collection Endpoint (DCE)\nAZURE_DCE_ENDPOINT=https://<dce-name>.<region>.ingest.monitor.azure.com\n\n# Data Collection Rule (DCR) immutable ID\nAZURE_DCR_RULE_ID=dcr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n# Stream name from DCR\nAZURE_DCR_STREAM_NAME=Custom-MyTable_CL\n```\n\n## Prerequisites\n\nBefore using this SDK, you need:\n\n1. **Log Analytics Workspace** — Target for your logs\n2. **Data Collection Endpoint (DCE)** — Ingestion endpoint\n3. **Data Collection Rule (DCR)** — Defines schema and destination\n4. **Custom Table** — In Log Analytics (created via DCR or manually)\n\n## Authentication\n\n```python\nfrom azure.monitor.ingestion import LogsIngestionClient\nfrom azure.identity import DefaultAzureCredential\nimport os\n\nclient = LogsIngestionClient(\n    endpoint=os.environ[\"AZURE_DCE_ENDPOINT\"],\n    credential=DefaultAzureCredential()\n)\n```\n\n## Upload Custom Logs\n\n```python\nfrom azure.monitor.ingestion import LogsIngestionClient\nfrom azure.identity import DefaultAzureCredential\nimport os\n\nclient = LogsIngestionClient(\n    endpoint=os.environ[\"AZURE_DCE_ENDPOINT\"],\n    credential=DefaultAzureCredential()\n)\n\nrule_id = os.environ[\"AZURE_DCR_RULE_ID\"]\nstream_name = os.environ[\"AZURE_DCR_STREAM_NAME\"]\n\nlogs = [\n    {\"TimeGenerated\": \"2024-01-15T10:00:00Z\", \"Computer\": \"server1\", \"Message\": \"Application started\"},\n    {\"TimeGenerated\": \"2024-01-15T10:01:00Z\", \"Computer\": \"server1\", \"Message\": \"Processing request\"},\n    {\"TimeGenerated\": \"2024-01-15T10:02:00Z\", \"Computer\": \"server2\", \"Message\": \"Connection established\"}\n]\n\nclient.upload(rule_id=rule_id, stream_name=stream_name, logs=logs)\n```\n\n## Upload from JSON File\n\n```python\nimport json\n\nwith open(\"logs.json\", \"r\") as f:\n    logs = json.load(f)\n\nclient.upload(rule_id=rule_id, stream_name=stream_name, logs=logs)\n```\n\n## Custom Error Handling\n\nHandle partial failures with a callback:\n\n```python\nfailed_logs = []\n\ndef on_error(error):\n    print(f\"Upload failed: {error.error}\")\n    failed_logs.extend(error.failed_logs)\n\nclient.upload(\n    rule_id=rule_id,\n    stream_name=stream_name,\n    logs=logs,\n    on_error=on_error\n)\n\n# Retry failed logs\nif failed_logs:\n    print(f\"Retrying {len(failed_logs)} failed logs...\")\n    client.upload(rule_id=rule_id, stream_name=stream_name, logs=failed_logs)\n```\n\n## Ignore Errors\n\n```python\ndef ignore_errors(error):\n    pass  # Silently ignore upload failures\n\nclient.upload(\n    rule_id=rule_id,\n    stream_name=stream_name,\n    logs=logs,\n    on_error=ignore_errors\n)\n```\n\n## Async Client\n\n```python\nimport asyncio\nfrom azure.monitor.ingestion.aio import LogsIngestionClient\nfrom azure.identity.aio import DefaultAzureCredential\n\nasync def upload_logs():\n    async with LogsIngestionClient(\n        endpoint=endpoint,\n        credential=DefaultAzureCredential()\n    ) as client:\n        await client.upload(\n            rule_id=rule_id,\n            stream_name=stream_name,\n            logs=logs\n        )\n\nasyncio.run(upload_logs())\n```\n\n## Sovereign Clouds\n\n```python\nfrom azure.identity import AzureAuthorityHosts, DefaultAzureCredential\nfrom azure.monitor.ingestion import LogsIngestionClient\n\n# Azure Government\ncredential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT)\nclient = LogsIngestionClient(\n    endpoint=\"https://example.ingest.monitor.azure.us\",\n    credential=credential,\n    credential_scopes=[\"https://monitor.azure.us/.default\"]\n)\n```\n\n## Batching Behavior\n\nThe SDK automatically:\n- Splits logs into chunks of 1MB or less\n- Compresses each chunk with gzip\n- Uploads chunks in parallel\n\nNo manual batching needed for large log sets.\n\n## Client Types\n\n| Client | Purpose |\n|--------|---------|\n| `LogsIngestionClient` | Sync client for uploading logs |\n| `LogsIngestionClient` (aio) | Async client for uploading logs |\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| **DCE** | Data Collection Endpoint — ingestion URL |\n| **DCR** | Data Collection Rule — defines schema, transformations, destination |\n| **Stream** | Named data flow within a DCR |\n| **Custom Table** | Target table in Log Analytics (ends with `_CL`) |\n\n## DCR Stream Name Format\n\nStream names follow patterns:\n- `Custom-<TableName>_CL` — For custom tables\n- `Microsoft-<TableName>` — For built-in tables\n\n## Best Practices\n\n1. **Use DefaultAzureCredential** for authentication\n2. **Handle errors gracefully** — use `on_error` callback for partial failures\n3. **Include TimeGenerated** — Required field for all logs\n4. **Match DCR schema** — Log fields must match DCR column definitions\n5. **Use async client** for high-throughput scenarios\n6. **Batch uploads** — SDK handles batching, but send reasonable chunks\n7. **Monitor ingestion** — Check Log Analytics for ingestion status\n8. **Use context manager** — Ensures proper client cleanup\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["azure","monitor","ingestion","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding"],"capabilities":["skill","source-sickn33","skill-azure-monitor-ingestion-py","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/azure-monitor-ingestion-py","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 34928 github stars · SKILL.md body (5,460 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-24T18:50:32.551Z","embedding":null,"createdAt":"2026-04-18T21:32:51.120Z","updatedAt":"2026-04-24T18:50:32.551Z","lastSeenAt":"2026-04-24T18:50:32.551Z","tsv":"'-01':197,209,221 '-15':198,210,222 '/.default':431 '00':200 '00z':201,213,225 '01':212 '02':224 '1':101,535 '1mb':442 '2':109,540 '2024':196,208,220 '3':116,551 '4':125,559 '5':570 '6':579 '7':589 '8':598 'action':618 'aio':473 'analyt':19,38,103,130,510,594 'api':24,44 'applic':205,612 'ask':656 'async':361,374,378,474,572 'asyncio':365 'asyncio.run':399 'authent':136,539 'author':418 'automat':436 'await':387 'azur':2,6,25,35,50,56,65,75,86,152,175,183,190,414 'azure-ident':55 'azure-monitor-ingest':49 'azure-monitor-ingestion-pi':1 'azure.identity':143,166,406 'azure.identity.aio':371 'azure.monitor.ingestion':139,162,411 'azure.monitor.ingestion.aio':367 'azureauthorityhost':408 'azureauthorityhosts.azure':419 'bash':46,60 'batch':432,456,580,584 'behavior':433 'best':533 'boundari':664 'built':530 'built-in':529 'callback':277,547 'check':592 'chunk':440,447,451,588 'cl':93,513,523 'clarif':658 'cleanup':605 'clear':631 'client':148,171,362,386,421,462,464,468,475,573,604 'client.upload':231,258,293,322,346,388 'cloud':403 'collect':62,70,111,118,485,491 'column':568 'compress':445 'comput':202,214,226 'concept':480,481 'connect':229 'context':600 'creat':131 'credenti':155,178,383,416,425,426,427 'criteria':667 'custom':15,32,91,126,158,269,504,522,525 'custom-myt':90 'data':61,69,110,117,484,490,499 'dce':64,66,113,153,176,483 'dcr':72,76,80,85,87,120,133,184,191,489,503,514,561,567 'dcr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx':79 'def':281,337,375 'defaultazurecredenti':145,156,168,179,373,384,409,417,537 'defin':121,493 'definit':569 'describ':619,635 'descript':482 'destin':124,496 'end':511 'endpoint':63,67,112,115,150,154,173,177,381,382,423,486 'ensur':602 'environ':58,647 'environment-specif':646 'error':270,283,284,305,307,335,339,340,358,360,542,546 'error.error':289 'error.failed':291 'establish':230 'example.ingest.monitor.azure.us':424 'execut':614 'expert':652 'f':254,257,286,315 'fail':279,288,309,312,318,320,332 'failed_logs.extend':290 'failur':274,345,550 'field':555,564 'file':245 'flow':500 'follow':520 'format':517 'govern':415,420 'grace':543 'gzip':449 'handl':271,272,541,583 'high':576 'high-throughput':575 'id':74,78,181,186,233,235,260,262,295,297,324,326,348,350,390,392 'ident':57 'ignor':334,338,343,359 'immut':73 'import':140,144,146,163,167,169,247,364,368,372,407,412 'includ':552 'ingest':4,8,23,27,43,52,114,487,591,596 'ingest.monitor.azure.com':68 'input':661 'instal':45,48,54 'json':244,248 'json.load':256 'key':479 'larg':459 'len':317 'less':444 'limit':623 'log':16,18,22,33,37,42,102,108,129,159,194,240,241,255,267,268,280,292,302,303,310,313,319,321,331,333,355,356,377,397,398,401,438,460,471,478,509,558,563,593 'logs.json':251 'logsingestioncli':141,149,164,172,369,380,413,422,466,472 'manag':601 'manual':135,455 'match':560,566,632 'messag':204,216,228 'microsoft':527 'miss':669 'monitor':3,7,26,36,51,590 'monitor.azure.us':430 'monitor.azure.us/.default':429 'must':565 'mytabl':92 'name':83,89,188,193,237,239,264,266,299,301,328,330,352,354,394,396,498,516,519 'need':100,457 'open':250 'os':147,170 'os.environ':151,174,182,189 'output':641 'overview':622 'parallel':453 'partial':273,549 'pass':341 'pattern':521 'permiss':662 'pip':47,53 'practic':534 'prerequisit':94 'print':285,314 'process':217 'proper':603 'purpos':465 'py':5 'python':11,30,137,160,246,278,336,363,404 'r':252 'reason':587 'request':218 'requir':554,660 'retri':308,316 'review':653 'rule':71,77,119,180,185,232,234,259,261,294,296,323,325,347,349,389,391,492 'safeti':663 'scenario':578 'schema':122,494,562 'scope':428,634 'sdk':9,28,98,435,582 'send':14,31,586 'server1':203,215 'server2':227 'set':461 'silent':342 'skill':610,626 'skill-azure-monitor-ingestion-py' 'source-sickn33' 'sovereign':402 'specif':648 'split':437 'start':206 'status':597 'stop':654 'stream':82,88,187,192,236,238,263,265,298,300,327,329,351,353,393,395,497,515,518 'substitut':644 'success':666 'sync':467 't10':199,211,223 'tabl':127,505,507,526,532 'target':105,506 'task':630 'test':650 'throughput':577 'timegener':195,207,219,553 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'transform':495 'treat':639 'type':463 'upload':157,242,287,344,376,400,450,470,477,581 'url':488 'use':12,40,96,536,544,571,599,608,624 'valid':649 'variabl':59 'via':21,132 'within':501 'workflow':616 'workspac':20,39,104 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx':81","prices":[{"id":"02f6605c-105d-4463-8213-abd67d2869ae","listingId":"f0aefdbc-b6ac-42cd-8e6b-4d066944af2a","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:32:51.120Z"}],"sources":[{"listingId":"f0aefdbc-b6ac-42cd-8e6b-4d066944af2a","source":"github","sourceId":"sickn33/antigravity-awesome-skills/azure-monitor-ingestion-py","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-monitor-ingestion-py","isPrimary":false,"firstSeenAt":"2026-04-18T21:32:51.120Z","lastSeenAt":"2026-04-24T18:50:32.551Z"}],"details":{"listingId":"f0aefdbc-b6ac-42cd-8e6b-4d066944af2a","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"azure-monitor-ingestion-py","github":{"repo":"sickn33/antigravity-awesome-skills","stars":34928,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-24T06:41:17Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"e634660e833004153ea927ab1b463a23859a9020","skill_md_path":"skills/azure-monitor-ingestion-py/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-monitor-ingestion-py"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"azure-monitor-ingestion-py","description":"Azure Monitor Ingestion SDK for Python. Use for sending custom logs to Log Analytics workspace via Logs Ingestion API."},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/azure-monitor-ingestion-py"},"updatedAt":"2026-04-24T18:50:32.551Z"}}