# Mapping flat log line dt.trace\_id and dt.span\_id to fields in OpenShift Loki

**URL:** <https://community.dynatrace.com/t/mapping-flat-log-line-dt-trace-id-and-dt-span-id-to-fields-in-openshift-loki/55724>\
**Category:** Dynatrace Managed\
**Tags:** distributed-traces-classic, openshift, dynatrace-managed, log-monitoring-class\
**Created:** [April 27, 2026, 2:27pm UTC](https://community.dynatrace.com/t/mapping-flat-log-line-dt-trace-id-and-dt-span-id-to-fields-in-openshift-loki/55724 "2026-04-27T14:27:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gilles\_tabary](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gilles\_tabary](https://community.dynatrace.com/u/gilles_tabary)\
**Post date:** [April 27, 2026, 2:27pm UTC](https://community.dynatrace.com/t/mapping-flat-log-line-dt-trace-id-and-dt-span-id-to-fields-in-openshift-loki/55724/1 "2026-04-27T14:27:42Z")

</div>

Hello.

I am on Managed.

We activated successfully auto OneAgent feature enrichement of **flat** log lines, in order to inject transaction & span ids. Fine.&nbsp;In OpenShift, Loki we get the log line :

```markup
22 avr. 2026, 16:22:01.354 10.130.50.2 - - [22/Apr/2026:16:21:52 +0200] "GET /health/liveness HTTP/2.0" 200 15 [!dt dt.trace_id=01234567890123456789012345678901, dt.span_id=0123456789012345,dt.trace_sampled=true]

```

but Loki cannot extract dt.trace\_id nor dt.span\_id as standard indexable fields like traceid & spanid. Coudl it be due to the leading “!dt” ?

_Derived Fields_ are Graphana specialty : not available in Loki. Transformation into loki label is strongly un-recommended because traceid & spanid are high cardinality, which would lead to Loki index saturation.

Any one did it (on flat log lines i.e. not structured) ? How to map log line elements with loki fields ?

Regards.

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [April 27, 2026, 7:04pm UTC](https://community.dynatrace.com/t/mapping-flat-log-line-dt-trace-id-and-dt-span-id-to-fields-in-openshift-loki/55724/2 "2026-04-27T19:04:59Z")

</div>

This should be asked in Grafana/Loki forum as it’s a Grafana/Loki issue. Since your log is unstructured, you will need to parse it and modify the log pipeline you have (Alloy?) to extract the Dynatrace metadata into standard metadata that you can then use.&nbsp; Your logging stack is simply not aware of Dynatrace added metadata.

---

<div class="post-metadata">

**Author:** ![gilles\_tabary](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gilles\_tabary](https://community.dynatrace.com/u/gilles_tabary)\
**Post date:** [April 29, 2026, 8:36am UTC](https://community.dynatrace.com/t/mapping-flat-log-line-dt-trace-id-and-dt-span-id-to-fields-in-openshift-loki/55724/3 "2026-04-29T08:36:11Z")

</div>

Hello.

It could also be rephrased as : why Dynatrace does not inject standard transaction & span id markers, automatically recognised by standard log concentratores. I am aware of one possible answer : Dynatrace allow potential coexisting transaction & span id systems, thus the proprietarry marking.

This is my rational for posting on a Dynatrace forum 🙂 Yet, your point does makes sens.

Let’s see if we can share experience.
