Registry / azure / azure-log-analytics-data-collector-api

azure-log-analytics-data-collector-api

JSON →
library0.4.0pypypiunverified

Unofficial Python client for the Azure Log Analytics Data Collector API (HTTP Data Collector API). Version 0.4.0 adds configurable endpoint. Infrequently updated; use for custom log ingestion where the official Azure Monitor SDK is not required.

pip install azure-log-analytics-data-collector-api==0.4.0
INSTALL
IMPORT
SIG · AZURE-LOG-ANALYTIC
A
azure-log-analytics-data-collector-api
azurepythonv0.4.0
Install
1.7s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LogAnalyticsDataCollectorClient
from datacollectorapi import LogAnalyticsDataCollectorClient
from azure_log_analytics_data_collector_api import LogAnalyticsDataCollectorClient

Creates client and sends custom log data. Remember to configure retention and custom log fields in Azure Portal.

import os from azure_log_analytics_data_collector_api import LogAnalyticsDataCollectorClient workspace_id = os.environ.get('AZURE_WORKSPACE_ID', '') shared_key = os.environ.get('AZURE_SHARED_KEY', '') client = LogAnalyticsDataCollectorClient(workspace_id, shared_key) records = [{"name": "test", "value": 1}] response = client.send(records, log_type='MyCustomLog_CL') print(response.status_code)
Debug
Known issues
gotchaLog type name must be alphanumeric plus underscore, max 100 characters. It is automatically suffixed with '_CL' by Azure, but DO NOT include '_CL' yourself in the parameter.
fix
Use log_type='MyLog' (not 'MyLog_CL'). The client does NOT add the suffix automatically; Azure adds it server-side.
affects: >=0.3.0
gotchaThe client does not validate the endpoint URL. If you pass an incorrect or non-Azure endpoint, the request will silently fail with a non-descriptive error.
fix
Always use the default endpoint for public Azure ('https://<workspace-id>.ods.opinsights.azure.com') or explicitly verify your custom endpoint.
affects: 0.4.0
deprecatedThis library is based on the deprecated Azure Log Analytics Data Collector API. Microsoft recommends using the official azure-monitor-ingestion library for new projects.
fix
Consider migrating to `azure-monitor-ingestion` (package: azure-monitor-ingestion) which is actively maintained.
affects: all
Upgrade
Version history
0.4.0latest on PyPI · released Jul 21, 2020
Audit
Dependencies
requestsrequiredHTTP client for API calls
Agent activity
32 hits · last 30 days
node
26
OpenAI (training)
1
Resources
azure-log-analytics-data-collector-api — pip install azure-log-analytics-data-collector-api · libregistry