1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
---
page_type: sample
languages:
- python
products:
- azure-monitor
---
# Microsoft Azure Monitor Opentelemetry Exporter Log Python Samples
These code samples show common champion scenario operations with the AzureMonitorLogExporter.
* Logs: [sample_log.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/samples/logs/sample_log.py)
* Trace correlation: [sample_log.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/samples/logs/sample_correlate.py)
* Custom properties: [sample_properties.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/samples/logs/sample_properties.py)
## Installation
```sh
$ pip install azure-monitor-opentelemetry-exporter --pre
```
## Run the Applications
### Logs
* Update `APPLICATIONINSIGHTS_CONNECTION_STRING` environment variable
* Run the sample
```sh
$ # from this directory
$ python sample_log.py
```
### Trace correlation
* Update `APPLICATIONINSIGHTS_CONNECTION_STRING` environment variable
* Run the sample
```sh
$ # from this directory
$ python sample_correlate.py
```
### Custom properties
* Update `APPLICATIONINSIGHTS_CONNECTION_STRING` environment variable
* Run the sample
```sh
$ # from this directory
$ python sample_properties.py
```
## Explore the data
After running the applications, data would be available in [Azure](
https://learn.microsoft.com/azure/azure-monitor/app/app-insights-overview#where-do-i-see-my-telemetry)
|