AzureMonitorLogExporter Class

Azure Monitor Log exporter for OpenTelemetry.

Azure Monitor base exporter for OpenTelemetry.

Inheritance
azure.monitor.opentelemetry.exporter.export._base.BaseExporter
AzureMonitorLogExporter
opentelemetry.sdk._logs._internal.export.LogExporter
AzureMonitorLogExporter

Constructor

AzureMonitorLogExporter(**kwargs: Any)

Keyword-Only Parameters

Name Description
api_version
str

The service API version used. Defaults to latest.

connection_string
str

The connection string used for your Application Insights resource.

credential
<xref:<xref:ManagedIdentityCredential/ClientSecretCredential>>

Token credential, such as ManagedIdentityCredential or ClientSecretCredential, used for Azure Active Directory (AAD) authentication. Defaults to None.

disable_offline_storage

Determines whether to disable storing failed telemetry records for retry. Defaults to False.

storage_directory
str

Storage path in which to store retry files. Defaults to <tempfile.gettempdir()>/opentelemetry-python-.

Methods

export

Export log data.

from_connection_string

Create an AzureMonitorLogExporter from a connection string. This is the recommended way of instantiation if a connection string is passed in explicitly. If a user wants to use a connection string provided by environment variable, the constructor of the exporter can be called directly.

shutdown

Shuts down the exporter.

Called when the SDK is shut down.

export

Export log data.

export(batch: Sequence[LogData], **kwargs: Any) -> LogExportResult

Parameters

Name Description
batch
Required
Sequence[<xref:opentelemetry._logs.LogData>]

OpenTelemetry LogData(s) to export.

Returns

Type Description
<xref:opentelemetry.sdk._logs.export.LogData>

The result of the export.

from_connection_string

Create an AzureMonitorLogExporter from a connection string. This is the recommended way of instantiation if a connection string is passed in explicitly. If a user wants to use a connection string provided by environment variable, the constructor of the exporter can be called directly.

from_connection_string(conn_str: str, **kwargs: Any) -> AzureMonitorLogExporter

Parameters

Name Description
conn_str
Required
str

The connection string to be used for authentication.

Keyword-Only Parameters

Name Description
api_version
str

The service API version used. Defaults to latest.

Returns

Type Description

an instance of ~AzureMonitorLogExporter

shutdown

Shuts down the exporter.

Called when the SDK is shut down.

shutdown() -> None