A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://aka.ms/azsdk/python/monitor-ingestion/docs below:

azure.monitor.ingestion package — Azure SDK for Python 2.0.0 documentation

Azure SDK for Python azure.monitor.ingestion package
class azure.monitor.ingestion.LogsIngestionClient(endpoint: str, credential: TokenCredential, **kwargs: Any)[source]

The synchronous client for uploading logs to Azure Monitor.

Parameters:
Keyword Arguments:

api_version (str) – Api Version. Default value is “2023-01-01”. Note that overriding this default value may result in unsupported behavior.

Example:

Creating the LogsIngestionClient with DefaultAzureCredential.
from azure.identity import DefaultAzureCredential
from azure.monitor.ingestion import LogsIngestionClient

credential = DefaultAzureCredential()
endpoint = "https://example.ingest.monitor.azure.com"
client = LogsIngestionClient(endpoint, credential)

Example:

Creating the LogsIngestionClient for use with a sovereign cloud (i.e. non-public cloud).
from azure.identity import AzureAuthorityHosts, DefaultAzureCredential
from azure.monitor.ingestion import LogsIngestionClient

credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT)
endpoint = "https://example.ingest.monitor.azure.us"
client = LogsIngestionClient(endpoint, credential, credential_scopes=["https://monitor.azure.us/.default"])
close() None[source]
send_request(request: HttpRequest, *, stream: bool = False, **kwargs: Any) HttpResponse[source]

Runs the network request through the client’s chained policies.

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

Parameters:

request (HttpRequest) – The network request you want to make. Required.

Keyword Arguments:

stream (bool) – Whether the response payload will be streamed. Defaults to False.

Returns:

The response of your network call. Does not do error handling on your response.

Return type:

HttpResponse

upload(rule_id: str, stream_name: str, logs: List[MutableMapping[str, Any]] | IO[bytes], *, on_error: Callable[[LogsUploadError], None] | None = None, **kwargs: Any) None

Ingestion API used to directly ingest data using Data Collection Rules.

A list of logs is divided into chunks of 1MB or less, then each chunk is gzip-compressed and uploaded. If an I/O stream is passed in, the stream is uploaded as-is.

Parameters:
  • rule_id (str) – The immutable ID of the Data Collection Rule resource.

  • stream_name (str) – The streamDeclaration name as defined in the Data Collection Rule.

  • logs (list[JSON] or IO) – An array of objects matching the schema defined by the provided stream.

Keyword Arguments:

on_error (Optional[Callable[[LogsUploadError], None]]) – The callback function that is called when a chunk of logs fails to upload. This function should expect one argument that corresponds to an “LogsUploadError” object. If no function is provided, then the first exception encountered will be raised.

Returns:

None

Return type:

None

Raises:

~azure.core.exceptions.HttpResponseError

class azure.monitor.ingestion.LogsUploadError(error: Exception, failed_logs: List[Mapping[str, Any]])[source]

Error information for a failed upload to Azure Monitor.

Parameters:
  • error (Exception) – The error that occurred during the upload.

  • failed_logs (list[JSON]) – The list of logs that failed to upload.

error: Exception

The error that occurred during the upload.

failed_logs: List[Mapping[str, Any]]

The list of logs that failed to upload.

Subpackages

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4