# Logging integration with OpenTelemetry

**URL:** <https://discuss.elastic.co/t/logging-integration-with-opentelemetry/345788>\
**Category:** APM\
**Tags:** open-telemetry\
**Created:** [October 26, 2023, 9:24am UTC](https://discuss.elastic.co/t/logging-integration-with-opentelemetry/345788 "2023-10-26T09:24:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fbutter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fbutter/32/126848_2.png) [@fbutter](https://discuss.elastic.co/u/fbutter)\
**Post date:** [October 26, 2023, 9:24am UTC](https://discuss.elastic.co/t/logging-integration-with-opentelemetry/345788/1 "2023-10-26T09:24:09Z")

</div>

OpenTelemetry and W3 defines span and trace id but no transaction id.

How to do the [log integration](https://www.elastic.co/guide/en/apm/guide/current/log-correlation.html) without the transaction id?

**Kibana version** : (Cloud) 8.5.3

**Elasticsearch version** : (Cloud) 8.5.3

**APM Server version** : (Cloud) 8.5.3

**APM Agent language and version** : opentelemetry-javaagent v1.31.0

---

<div class="post-metadata">

**Author:** ![kyungeunni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kyungeunni/32/125539_2.png) [@kyungeunni](https://discuss.elastic.co/u/kyungeunni)\
**Post date:** [October 27, 2023, 7:42am UTC](https://discuss.elastic.co/t/logging-integration-with-opentelemetry/345788/2 "2023-10-27T07:42:50Z")

</div>

Hi @fbutter,

if the log is sent from an OpenTelemetry agent to the APM Server, APM Server will translate the root span or certain kinds of spans as a transaction when receiving otel data so that the logs will contain the transaction ID which can be the same as the root span ID.

Here's how to set up the exporter for the logging: [OpenTelemetry native support | APM User Guide [8.10] | Elastic](https://www.elastic.co/guide/en/apm/guide/current/open-telemetry-direct.html#instrument-apps-otel)

---

<div class="post-metadata">

**Author:** ![fbutter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fbutter/32/126848_2.png) [@fbutter](https://discuss.elastic.co/u/fbutter)\
**Post date:** [October 27, 2023, 11:30am UTC](https://discuss.elastic.co/t/logging-integration-with-opentelemetry/345788/5 "2023-10-27T11:30:11Z")

</div>

Hi @kyungeunni , thank you.

I'm sorry, my question was misleading.

We are using OpenTelemetry for the sending metrics and traces to the monitoring backend. The logs are sent via Filebeat.

In detail, we use the span and trace id from the OpenTelemetry agent and build (together with other log relevant information) a structured log (JSON) that is sent to the monitoring backend.

---

<div class="post-metadata">

**Author:** ![fbutter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fbutter/32/126848_2.png) [@fbutter](https://discuss.elastic.co/u/fbutter)\
**Post date:** [October 27, 2023, 11:31am UTC](https://discuss.elastic.co/t/logging-integration-with-opentelemetry/345788/6 "2023-10-27T11:31:09Z")

</div>

Is the OpenTelemetry logging integration with Elastic Observability production-ready although the Events API is still experimental?

---

<div class="post-metadata">

**Author:** ![fbutter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fbutter/32/126848_2.png) [@fbutter](https://discuss.elastic.co/u/fbutter)\
**Post date:** [October 31, 2023, 12:56pm UTC](https://discuss.elastic.co/t/logging-integration-with-opentelemetry/345788/7 "2023-10-31T12:56:41Z")

</div>

Found the info here: Its in preview state [Limitations | APM User Guide [8.10] | Elastic](https://www.elastic.co/guide/en/apm/guide/current/open-telemetry-known-limitations.html)

---

<div class="post-metadata">

**Author:** ![kyungeunni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kyungeunni/32/125539_2.png) [@kyungeunni](https://discuss.elastic.co/u/kyungeunni)\
**Post date:** [November 16, 2023, 10:40am UTC](https://discuss.elastic.co/t/logging-integration-with-opentelemetry/345788/8 "2023-11-16T10:40:40Z")

</div>

Hi Florian,

So sorry for getting back to you so late.  
Yes OpenTelemetry logging integration with Elastic Observability is in preview state indeed.

> We are using OpenTelemetry for the sending metrics and traces to the monitoring backend. The logs are sent via Filebeat.  
> In detail, we use the span and trace id from the OpenTelemetry agent and build (together with other log relevant information) a structured log (JSON) that is sent to the monitoring backend.

We don't have support for that yet, but you might want to try duplicating every id in the log and set it as both a transaction and span ID. I have not tried it on my side so it might not work and the UI could break, that's what we can suggest right now. Apologies for not being super helpful. I will deliver this case to our product team.

Thanks,  
Kyungeun

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 14, 2023, 10:41am UTC](https://discuss.elastic.co/t/logging-integration-with-opentelemetry/345788/9 "2023-12-14T10:41:23Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
