# Azure Monitor Ingestion client library for Python
The Azure Monitor Ingestion client library is used to send custom logs to [Azure Monitor][azure_monitor_overview] using the [Logs Ingestion API][ingestion_overview].
This library allows you to send data from virtually any source to supported built-in tables or to custom tables that you create in Log Analytics workspace. You can even extend the schema of built-in tables with custom columns.
**Resources:**
- [Source code][source]
- [Package (PyPI)][package]
- [Package (Conda)](https://anaconda.org/microsoft/azure-monitor-ingestion/)
- [API reference documentation][python-ingestion-ref-docs]
- [Service documentation][azure_monitor_overview]
- [Samples][samples]
- [Change log][changelog]
## Getting started
### Prerequisites
- Python 3.7 or later
- An [Azure subscription][azure_subscription]
- An [Azure Log Analytics workspace][azure_monitor_create_using_portal]
- A [Data Collection Endpoint][data_collection_endpoint]
- A [Data Collection Rule][data_collection_rule]
### Install the package
Install the Azure Monitor Ingestion client library for Python with [pip][pip]:
```bash
pip install azure-monitor-ingestion
```
### Create the client
An authenticated client is required to upload Logs to Azure Monitor. The library includes both synchronous and asynchronous forms of the clients. To authenticate, create an instance of a token credential. Use that instance when creating a `LogsIngestionClient`. The following examples use `DefaultAzureCredential` from the [azure-identity](https://pypi.org/project/azure-identity/) package.
#### Synchronous clients
Consider the following example, which creates synchronous clients for uploading logs:
```python
import os
from azure.identity import DefaultAzureCredential
from azure.monitor.ingestion import LogsIngestionClient
endpoint = os.environ['DATA_COLLECTION_ENDPOINT']
credential = DefaultAzureCredential()
logs_client = LogsIngestionClient(endpoint, credential)
```
#### Asynchronous clients
The asynchronous forms of the client APIs are found in the `.aio`-suffixed namespace. For example:
```python
import os
from azure.identity.aio import DefaultAzureCredential
from azure.monitor.ingestion.aio import LogsIngestionClient
endpoint = os.environ['DATA_COLLECTION_ENDPOINT']
credential = DefaultAzureCredential()
logs_client = LogsIngestionClient(endpoint, credential)
```
#### Configure clients for non-public Azure clouds
By default, `LogsIngestionClient` is configured to connect to the public Azure cloud. To connect to non-public Azure clouds, some additional configuration is required. The appropriate scope for authentication must be provided using the `credential_scopes` keyword argument. The following example shows how to configure the client to connect to Azure US Government:
```python
from azure.identity import AzureAuthorityHosts, DefaultAzureCredential
from azure.monitor.ingestion import LogsIngestionClient
# Authority can also be set via the AZURE_AUTHORITY_HOST environment variable.
credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT)
logs_client = LogsIngestionClient(endpoint, credential, credential_scopes=["https://monitor.azure.us/.default"])
```
## Key concepts
### Data Collection Endpoint
Data Collection Endpoints (DCEs) allow you to uniquely configure ingestion settings for Azure Monitor. [This article][data_collection_endpoint] provides an overview of data collection endpoints including their contents and structure and how you can create and work with them.
### Data Collection Rule
Data collection rules (DCR) define data collected by Azure Monitor and specify how and where that data should be sent or stored. The REST API call must specify a DCR to use. A single DCE can support multiple DCRs, so you can specify a different DCR for different sources and target tables.
The DCR must understand the structure of the input data and the structure of the target table. If the two don't match, it can use a transformation to convert the source data to match the target table. You may also use the transform to filter source data and perform any other calculations or conversions.
For more information, see [Data collection rules in Azure Monitor][data_collection_rule], and see [this article][data_collection_rule_structure] for details about a DCR's structure. For information on how to retrieve a DCR ID, see [this tutorial][data_collection_rule_tutorial].
### Log Analytics workspace tables
Custom logs can send data to any custom table that you create and to certain built-in tables in your Log Analytics workspace. The target table must exist before you can send data to it. The following built-in tables are currently supported:
- [CommonSecurityLog](https://learn.microsoft.com/azure/azure-monitor/reference/tables/commonsecuritylog)
- [SecurityEvents](https://learn.microsoft.com/azure/azure-monitor/reference/tables/securityevent)
- [Syslog](https://learn.microsoft.com/azure/azure-monitor/reference/tables/syslog)
- [WindowsEvents](https://learn.microsoft.com/azure/azure-monitor/reference/tables/windowsevent)
### Logs retrieval
The logs that were uploaded using this library can be queried using the [Azure Monitor Query][azure_monitor_query] client library.
## Examples
- [Upload custom logs](#upload-custom-logs)
- [Upload data from JSON file or string](#upload-data-from-json-file-or-string)
- [Upload with custom error handling](#upload-with-custom-error-handling)
### Upload custom logs
This example shows uploading logs to Azure Monitor.
```python
import os
from azure.core.exceptions import HttpResponseError
from azure.identity import DefaultAzureCredential
from azure.monitor.ingestion import LogsIngestionClient
endpoint = os.environ['DATA_COLLECTION_ENDPOINT']
rule_id = os.environ['LOGS_DCR_RULE_ID']
stream_name = os.environ['LOGS_DCR_STREAM_NAME']
credential = DefaultAzureCredential()
client = LogsIngestionClient(endpoint=endpoint, credential=credential, logging_enable=True)
body = [
{
"Time": "2021-12-08T23:51:14.1104269Z",
"Computer": "Computer1",
"AdditionalContext": "context-2"
},
{
"Time": "2021-12-08T23:51:14.1104269Z",
"Computer": "Computer2",
"AdditionalContext": "context"
}
]
try:
client.upload(rule_id=rule_id, stream_name=stream_name, logs=body)
except HttpResponseError as e:
print(f"Upload failed: {e}")
```
### Upload data from JSON file or string
This example shows uploading when the data is in a JSON file or string.
```python
import json
import os
from azure.core.exceptions import HttpResponseError
from azure.identity import DefaultAzureCredential
from azure.monitor.ingestion import LogsIngestionClient
endpoint = os.environ["DATA_COLLECTION_ENDPOINT"]
rule_id = os.environ['LOGS_DCR_RULE_ID']
stream_name = os.environ["LOGS_DCR_STREAM_NAME"]
credential = DefaultAzureCredential()
client = LogsIngestionClient(endpoint=endpoint, credential=credential, logging_enable=True)
# If you have a JSON file containing an array of JSON objects
file_path = "./test-logs.json"
with open(file_path, "r") as f:
logs = json.load(f)
try:
client.upload(rule_id=rule_id, stream_name=stream_name, logs=logs)
except HttpResponseError as e:
print(f"Upload failed: {e}")
# If you have a JSON string representing an array of JSON objects
string = '[{"Time": "2023-12-08T23:51:14.1104269Z", "Computer": "Computer1", "AdditionalContext": "context-2"}]'
logs = json.loads(string)
try:
client.upload(rule_id=rule_id, stream_name=stream_name, logs=logs)
except HttpResponseError as e:
print(f"Upload failed: {e}")
```
### Upload with custom error handling
To upload logs with custom error handling, you can pass a callback function to the `on_error` parameter of the `upload` method. The callback function is called for each error that occurs during the upload and should expect one argument that corresponds to an `LogsUploadError` object. This object contains the error encountered and the list of logs that failed to upload.
```python
# Example 1: Collect all logs that failed to upload.
failed_logs = []
def on_error(error):
print("Log chunk failed to upload with error: ", error.error)
failed_logs.extend(error.failed_logs)
# Example 2: Ignore all errors.
def on_error_pass(error):
pass
client.upload(rule_id=rule_id, stream_name=stream_name, logs=body, on_error=on_error)
```
## Troubleshooting
For details on diagnosing various failure scenarios, see our [troubleshooting guide](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/TROUBLESHOOTING.md).
## Next steps
To learn more about Azure Monitor, see the [Azure Monitor service documentation][azure_monitor_overview].
### Samples
The following code samples show common scenarios with the Azure Monitor Ingestion client library.
#### Logs Ingestion samples
- [Upload a list of logs][sample_send_small_logs] ([async sample][sample_send_small_logs_async])
- [Upload a list of logs with custom error handling][sample_custom_error_callback] ([async sample][sample_custom_error_callback_async])
- [Upload the contents of a file][sample_upload_file_contents] ([async sample][sample_upload_file_contents_async])
- [Upload data in a pandas DataFrame][sample_upload_pandas_dataframe] ([async sample][sample_upload_pandas_dataframe_async])
## Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.
<!-- LINKS -->
[azure_core_exceptions]: https://aka.ms/azsdk/python/core/docs#module-azure.core.exceptions
[azure_core_ref_docs]: https://aka.ms/azsdk/python/core/docs
[azure_monitor_create_using_portal]: https://learn.microsoft.com/azure/azure-monitor/logs/quick-create-workspace
[azure_monitor_overview]: https://learn.microsoft.com/azure/azure-monitor/
[azure_monitor_query]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-query#readme
[azure_subscription]: https://azure.microsoft.com/free/python/
[changelog]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-ingestion/CHANGELOG.md
[data_collection_endpoint]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-endpoint-overview
[data_collection_rule]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-rule-overview
[data_collection_rule_structure]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-rule-structure
[data_collection_rule_tutorial]: https://learn.microsoft.com/azure/azure-monitor/logs/tutorial-logs-ingestion-portal#collect-information-from-the-dcr
[ingestion_overview]: https://learn.microsoft.com/azure/azure-monitor/logs/logs-ingestion-api-overview
[package]: https://aka.ms/azsdk-python-monitor-ingestion-pypi
[pip]: https://pypi.org/project/pip/
[python_logging]: https://docs.python.org/3/library/logging.html
[python-ingestion-ref-docs]: https://aka.ms/azsdk/python/monitor-ingestion/docs
[samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-ingestion/samples
[source]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/
[sample_send_small_logs]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_send_small_logs.py
[sample_send_small_logs_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_send_small_logs_async.py
[sample_custom_error_callback]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_custom_error_callback.py
[sample_custom_error_callback_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_custom_error_callback_async.py
[sample_upload_file_contents]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_upload_file_contents.py
[sample_upload_file_contents_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_upload_file_contents_async.py
[sample_upload_pandas_dataframe]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_upload_pandas_dataframe.py
[sample_upload_pandas_dataframe_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_upload_pandas_dataframe_async.py
[cla]: https://cla.microsoft.com
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
[coc_contact]: mailto:opencode@microsoft.com
# Release History
## 1.0.4 (2024-06-11)
### Other Changes
- Bumped minimum dependency on `azure-core` to `>=1.28.0`.
- Added additional type validation for the `logs` parameter in the `upload` method to ensure that a string hasn't been passed in. ([#33976](https://github.com/Azure/azure-sdk-for-python/pull/33976))
## 1.0.3 (2023-11-07)
### Other Changes
- Add type validation for the `logs` parameter in the `upload` method. ([#32591](https://github.com/Azure/azure-sdk-for-python/pull/32591/))
## 1.0.2 (2023-06-15)
### Bugs Fixed
- Fixed issue preventing custom authentication policies or credential scopes to be passed to the client. ([#30739](https://github.com/Azure/azure-sdk-for-python/pull/30739/))
## 1.0.1 (2023-04-11)
### Bugs Fixed
- Fixed an issue where log entry sizes were miscalculated when chunking. ([#29584](https://github.com/Azure/azure-sdk-for-python/pull/29584))
## 1.0.0 (2023-02-16)
### Features Added
- Added new `on_error` parameter to the `upload` method to allow users to handle errors in their own way.
- An `LogsUploadError` class was added to encapsulate information about the error. An instance of this class is passed to the `on_error` callback.
- Added IO support for upload. Now IO streams can be passed in using the `logs` parameter. ([#28373](https://github.com/Azure/azure-sdk-for-python/pull/28373))
### Breaking Changes
- Removed support for max_concurrency
### Other Changes
- Removed `msrest` dependency.
- Added requirement for `isodate>=0.6.0` (`isodate` was required by `msrest`).
- Added requirement for `typing-extensions>=4.0.1`.
## 1.0.0b1 (2022-07-15)
## Features
- Version (1.0.0b1) is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Monitor Ingestion.
For more information about this, and preview releases of other Azure SDK libraries, please visit https://azure.github.io/azure-sdk/releases/latest/python.html.
- Added `~azure.monitor.ingestion.LogsIngestionClient` to send logs to Azure Monitor along with `~azure.monitor.ingestion.aio.LogsIngestionClient`.
Raw data
{
"_id": null,
"home_page": "https://github.com/Azure/azure-sdk-for-python",
"name": "azure-monitor-ingestion",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "azure, azure sdk",
"author": "Microsoft Corporation",
"author_email": "azpysdkhelp@microsoft.com",
"download_url": "https://files.pythonhosted.org/packages/7d/41/4faf617e09a90f45c253190e600941bf97f10cfd1a811ec139ae3b54e56b/azure-monitor-ingestion-1.0.4.tar.gz",
"platform": null,
"description": "# Azure Monitor Ingestion client library for Python\n\nThe Azure Monitor Ingestion client library is used to send custom logs to [Azure Monitor][azure_monitor_overview] using the [Logs Ingestion API][ingestion_overview].\n\nThis library allows you to send data from virtually any source to supported built-in tables or to custom tables that you create in Log Analytics workspace. You can even extend the schema of built-in tables with custom columns.\n\n**Resources:**\n\n- [Source code][source]\n- [Package (PyPI)][package]\n- [Package (Conda)](https://anaconda.org/microsoft/azure-monitor-ingestion/)\n- [API reference documentation][python-ingestion-ref-docs]\n- [Service documentation][azure_monitor_overview]\n- [Samples][samples]\n- [Change log][changelog]\n\n## Getting started\n\n### Prerequisites\n\n- Python 3.7 or later\n- An [Azure subscription][azure_subscription]\n- An [Azure Log Analytics workspace][azure_monitor_create_using_portal]\n- A [Data Collection Endpoint][data_collection_endpoint]\n- A [Data Collection Rule][data_collection_rule]\n\n### Install the package\n\nInstall the Azure Monitor Ingestion client library for Python with [pip][pip]:\n\n```bash\npip install azure-monitor-ingestion\n```\n\n### Create the client\n\nAn authenticated client is required to upload Logs to Azure Monitor. The library includes both synchronous and asynchronous forms of the clients. To authenticate, create an instance of a token credential. Use that instance when creating a `LogsIngestionClient`. The following examples use `DefaultAzureCredential` from the [azure-identity](https://pypi.org/project/azure-identity/) package.\n\n#### Synchronous clients\n\nConsider the following example, which creates synchronous clients for uploading logs:\n\n```python\nimport os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.monitor.ingestion import LogsIngestionClient\n\nendpoint = os.environ['DATA_COLLECTION_ENDPOINT']\ncredential = DefaultAzureCredential()\nlogs_client = LogsIngestionClient(endpoint, credential)\n```\n\n#### Asynchronous clients\n\nThe asynchronous forms of the client APIs are found in the `.aio`-suffixed namespace. For example:\n\n```python\nimport os\nfrom azure.identity.aio import DefaultAzureCredential\nfrom azure.monitor.ingestion.aio import LogsIngestionClient\n\nendpoint = os.environ['DATA_COLLECTION_ENDPOINT']\ncredential = DefaultAzureCredential()\nlogs_client = LogsIngestionClient(endpoint, credential)\n```\n\n#### Configure clients for non-public Azure clouds\n\nBy default, `LogsIngestionClient` is configured to connect to the public Azure cloud. To connect to non-public Azure clouds, some additional configuration is required. The appropriate scope for authentication must be provided using the `credential_scopes` keyword argument. The following example shows how to configure the client to connect to Azure US Government:\n\n```python\nfrom azure.identity import AzureAuthorityHosts, DefaultAzureCredential\nfrom azure.monitor.ingestion import LogsIngestionClient\n\n# Authority can also be set via the AZURE_AUTHORITY_HOST environment variable.\ncredential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT)\nlogs_client = LogsIngestionClient(endpoint, credential, credential_scopes=[\"https://monitor.azure.us/.default\"])\n```\n\n## Key concepts\n\n### Data Collection Endpoint\n\nData Collection Endpoints (DCEs) allow you to uniquely configure ingestion settings for Azure Monitor. [This article][data_collection_endpoint] provides an overview of data collection endpoints including their contents and structure and how you can create and work with them.\n\n### Data Collection Rule\n\nData collection rules (DCR) define data collected by Azure Monitor and specify how and where that data should be sent or stored. The REST API call must specify a DCR to use. A single DCE can support multiple DCRs, so you can specify a different DCR for different sources and target tables.\n\nThe DCR must understand the structure of the input data and the structure of the target table. If the two don't match, it can use a transformation to convert the source data to match the target table. You may also use the transform to filter source data and perform any other calculations or conversions.\n\nFor more information, see [Data collection rules in Azure Monitor][data_collection_rule], and see [this article][data_collection_rule_structure] for details about a DCR's structure. For information on how to retrieve a DCR ID, see [this tutorial][data_collection_rule_tutorial].\n\n### Log Analytics workspace tables\n\nCustom logs can send data to any custom table that you create and to certain built-in tables in your Log Analytics workspace. The target table must exist before you can send data to it. The following built-in tables are currently supported:\n\n- [CommonSecurityLog](https://learn.microsoft.com/azure/azure-monitor/reference/tables/commonsecuritylog)\n- [SecurityEvents](https://learn.microsoft.com/azure/azure-monitor/reference/tables/securityevent)\n- [Syslog](https://learn.microsoft.com/azure/azure-monitor/reference/tables/syslog)\n- [WindowsEvents](https://learn.microsoft.com/azure/azure-monitor/reference/tables/windowsevent)\n\n### Logs retrieval\n\nThe logs that were uploaded using this library can be queried using the [Azure Monitor Query][azure_monitor_query] client library.\n\n## Examples\n\n- [Upload custom logs](#upload-custom-logs)\n- [Upload data from JSON file or string](#upload-data-from-json-file-or-string)\n- [Upload with custom error handling](#upload-with-custom-error-handling)\n\n### Upload custom logs\n\nThis example shows uploading logs to Azure Monitor.\n\n```python\nimport os\n\nfrom azure.core.exceptions import HttpResponseError\nfrom azure.identity import DefaultAzureCredential\nfrom azure.monitor.ingestion import LogsIngestionClient\n\nendpoint = os.environ['DATA_COLLECTION_ENDPOINT']\nrule_id = os.environ['LOGS_DCR_RULE_ID']\nstream_name = os.environ['LOGS_DCR_STREAM_NAME']\n\ncredential = DefaultAzureCredential()\nclient = LogsIngestionClient(endpoint=endpoint, credential=credential, logging_enable=True)\n\nbody = [\n {\n \"Time\": \"2021-12-08T23:51:14.1104269Z\",\n \"Computer\": \"Computer1\",\n \"AdditionalContext\": \"context-2\"\n },\n {\n \"Time\": \"2021-12-08T23:51:14.1104269Z\",\n \"Computer\": \"Computer2\",\n \"AdditionalContext\": \"context\"\n }\n ]\n\ntry:\n client.upload(rule_id=rule_id, stream_name=stream_name, logs=body)\nexcept HttpResponseError as e:\n print(f\"Upload failed: {e}\")\n```\n\n### Upload data from JSON file or string\n\nThis example shows uploading when the data is in a JSON file or string.\n\n```python\nimport json\nimport os\n\nfrom azure.core.exceptions import HttpResponseError\nfrom azure.identity import DefaultAzureCredential\nfrom azure.monitor.ingestion import LogsIngestionClient\n\nendpoint = os.environ[\"DATA_COLLECTION_ENDPOINT\"]\nrule_id = os.environ['LOGS_DCR_RULE_ID']\nstream_name = os.environ[\"LOGS_DCR_STREAM_NAME\"]\n\ncredential = DefaultAzureCredential()\nclient = LogsIngestionClient(endpoint=endpoint, credential=credential, logging_enable=True)\n\n# If you have a JSON file containing an array of JSON objects\nfile_path = \"./test-logs.json\"\nwith open(file_path, \"r\") as f:\n logs = json.load(f)\n try:\n client.upload(rule_id=rule_id, stream_name=stream_name, logs=logs)\n except HttpResponseError as e:\n print(f\"Upload failed: {e}\")\n\n# If you have a JSON string representing an array of JSON objects\nstring = '[{\"Time\": \"2023-12-08T23:51:14.1104269Z\", \"Computer\": \"Computer1\", \"AdditionalContext\": \"context-2\"}]'\nlogs = json.loads(string)\ntry:\n client.upload(rule_id=rule_id, stream_name=stream_name, logs=logs)\nexcept HttpResponseError as e:\n print(f\"Upload failed: {e}\")\n```\n\n### Upload with custom error handling\n\nTo upload logs with custom error handling, you can pass a callback function to the `on_error` parameter of the `upload` method. The callback function is called for each error that occurs during the upload and should expect one argument that corresponds to an `LogsUploadError` object. This object contains the error encountered and the list of logs that failed to upload.\n\n```python\n# Example 1: Collect all logs that failed to upload.\nfailed_logs = []\ndef on_error(error):\n print(\"Log chunk failed to upload with error: \", error.error)\n failed_logs.extend(error.failed_logs)\n\n# Example 2: Ignore all errors.\ndef on_error_pass(error):\n pass\n\nclient.upload(rule_id=rule_id, stream_name=stream_name, logs=body, on_error=on_error)\n```\n\n## Troubleshooting\n\nFor details on diagnosing various failure scenarios, see our [troubleshooting guide](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/TROUBLESHOOTING.md).\n\n## Next steps\n\nTo learn more about Azure Monitor, see the [Azure Monitor service documentation][azure_monitor_overview].\n\n### Samples\n\nThe following code samples show common scenarios with the Azure Monitor Ingestion client library.\n\n#### Logs Ingestion samples\n\n- [Upload a list of logs][sample_send_small_logs] ([async sample][sample_send_small_logs_async])\n- [Upload a list of logs with custom error handling][sample_custom_error_callback] ([async sample][sample_custom_error_callback_async])\n- [Upload the contents of a file][sample_upload_file_contents] ([async sample][sample_upload_file_contents_async])\n- [Upload data in a pandas DataFrame][sample_upload_pandas_dataframe] ([async sample][sample_upload_pandas_dataframe_async])\n\n## Contributing\n\nThis project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].\n\nWhen you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.\n\n<!-- LINKS -->\n\n[azure_core_exceptions]: https://aka.ms/azsdk/python/core/docs#module-azure.core.exceptions\n[azure_core_ref_docs]: https://aka.ms/azsdk/python/core/docs\n[azure_monitor_create_using_portal]: https://learn.microsoft.com/azure/azure-monitor/logs/quick-create-workspace\n[azure_monitor_overview]: https://learn.microsoft.com/azure/azure-monitor/\n[azure_monitor_query]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-query#readme\n[azure_subscription]: https://azure.microsoft.com/free/python/\n[changelog]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-ingestion/CHANGELOG.md\n[data_collection_endpoint]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-endpoint-overview\n[data_collection_rule]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-rule-overview\n[data_collection_rule_structure]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-collection-rule-structure\n[data_collection_rule_tutorial]: https://learn.microsoft.com/azure/azure-monitor/logs/tutorial-logs-ingestion-portal#collect-information-from-the-dcr\n[ingestion_overview]: https://learn.microsoft.com/azure/azure-monitor/logs/logs-ingestion-api-overview\n[package]: https://aka.ms/azsdk-python-monitor-ingestion-pypi\n[pip]: https://pypi.org/project/pip/\n[python_logging]: https://docs.python.org/3/library/logging.html\n[python-ingestion-ref-docs]: https://aka.ms/azsdk/python/monitor-ingestion/docs\n[samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-ingestion/samples\n[source]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/\n\n[sample_send_small_logs]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_send_small_logs.py\n[sample_send_small_logs_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_send_small_logs_async.py\n[sample_custom_error_callback]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_custom_error_callback.py\n[sample_custom_error_callback_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_custom_error_callback_async.py\n[sample_upload_file_contents]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_upload_file_contents.py\n[sample_upload_file_contents_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_upload_file_contents_async.py\n[sample_upload_pandas_dataframe]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_upload_pandas_dataframe.py\n[sample_upload_pandas_dataframe_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_upload_pandas_dataframe_async.py\n\n[cla]: https://cla.microsoft.com\n[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/\n[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/\n[coc_contact]: mailto:opencode@microsoft.com\n\n\n# Release History\n\n## 1.0.4 (2024-06-11)\n\n### Other Changes\n\n- Bumped minimum dependency on `azure-core` to `>=1.28.0`.\n- Added additional type validation for the `logs` parameter in the `upload` method to ensure that a string hasn't been passed in. ([#33976](https://github.com/Azure/azure-sdk-for-python/pull/33976))\n\n## 1.0.3 (2023-11-07)\n\n### Other Changes\n\n- Add type validation for the `logs` parameter in the `upload` method. ([#32591](https://github.com/Azure/azure-sdk-for-python/pull/32591/))\n\n## 1.0.2 (2023-06-15)\n\n### Bugs Fixed\n\n- Fixed issue preventing custom authentication policies or credential scopes to be passed to the client. ([#30739](https://github.com/Azure/azure-sdk-for-python/pull/30739/))\n\n## 1.0.1 (2023-04-11)\n\n### Bugs Fixed\n - Fixed an issue where log entry sizes were miscalculated when chunking. ([#29584](https://github.com/Azure/azure-sdk-for-python/pull/29584))\n\n## 1.0.0 (2023-02-16)\n\n### Features Added\n - Added new `on_error` parameter to the `upload` method to allow users to handle errors in their own way.\n - An `LogsUploadError` class was added to encapsulate information about the error. An instance of this class is passed to the `on_error` callback.\n - Added IO support for upload. Now IO streams can be passed in using the `logs` parameter. ([#28373](https://github.com/Azure/azure-sdk-for-python/pull/28373))\n\n### Breaking Changes\n - Removed support for max_concurrency\n\n### Other Changes\n - Removed `msrest` dependency.\n - Added requirement for `isodate>=0.6.0` (`isodate` was required by `msrest`).\n - Added requirement for `typing-extensions>=4.0.1`.\n\n## 1.0.0b1 (2022-07-15)\n\n ## Features\n - Version (1.0.0b1) is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Monitor Ingestion.\n For more information about this, and preview releases of other Azure SDK libraries, please visit https://azure.github.io/azure-sdk/releases/latest/python.html.\n - Added `~azure.monitor.ingestion.LogsIngestionClient` to send logs to Azure Monitor along with `~azure.monitor.ingestion.aio.LogsIngestionClient`.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Microsoft Azure Monitor Ingestion Client Library for Python",
"version": "1.0.4",
"project_urls": {
"Homepage": "https://github.com/Azure/azure-sdk-for-python"
},
"split_keywords": [
"azure",
" azure sdk"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "bfbaf6dee9ef082e164e8c5d239ffabb13580bac3061b9096f0f4af1b6a7929e",
"md5": "4a50a2141fcf523120f1ba0e08088313",
"sha256": "c484f60dd75deb56f1625c12c09cedbda545fcdc4f417396c510fa2efb2fe9c1"
},
"downloads": -1,
"filename": "azure_monitor_ingestion-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4a50a2141fcf523120f1ba0e08088313",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 46009,
"upload_time": "2024-06-11T19:33:22",
"upload_time_iso_8601": "2024-06-11T19:33:22.539405Z",
"url": "https://files.pythonhosted.org/packages/bf/ba/f6dee9ef082e164e8c5d239ffabb13580bac3061b9096f0f4af1b6a7929e/azure_monitor_ingestion-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7d414faf617e09a90f45c253190e600941bf97f10cfd1a811ec139ae3b54e56b",
"md5": "d84c32797a4b910ee4f7fada4b5a0fdc",
"sha256": "254d75993a1fe707d198f014aef5a14faa570cee7369b35bb03ae2aa8f99be79"
},
"downloads": -1,
"filename": "azure-monitor-ingestion-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "d84c32797a4b910ee4f7fada4b5a0fdc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 50607,
"upload_time": "2024-06-11T19:33:20",
"upload_time_iso_8601": "2024-06-11T19:33:20.607679Z",
"url": "https://files.pythonhosted.org/packages/7d/41/4faf617e09a90f45c253190e600941bf97f10cfd1a811ec139ae3b54e56b/azure-monitor-ingestion-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-11 19:33:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Azure",
"github_project": "azure-sdk-for-python",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "azure-monitor-ingestion"
}