<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Grafana Alloy on Grafana Labs</title><link>https://grafana.com/docs/tempo/v3.0.x/set-up-for-tracing/instrument-send/set-up-collector/grafana-alloy/</link><description>Recent content in Grafana Alloy on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/tempo/v3.0.x/set-up-for-tracing/instrument-send/set-up-collector/grafana-alloy/index.xml" rel="self" type="application/rss+xml"/><item><title>Migrate to Alloy</title><link>https://grafana.com/docs/tempo/v3.0.x/set-up-for-tracing/instrument-send/set-up-collector/grafana-alloy/migrate-alloy/</link><pubDate>Thu, 28 May 2026 17:50:33 +0100</pubDate><guid>https://grafana.com/docs/tempo/v3.0.x/set-up-for-tracing/instrument-send/set-up-collector/grafana-alloy/migrate-alloy/</guid><content><![CDATA[&lt;h1 id=&#34;migrate-to-alloy&#34;&gt;Migrate to Alloy&lt;/h1&gt;
&lt;p&gt;Grafana Labs has provided tools and migration documentation to assist you in migrating to Grafana Alloy.&lt;/p&gt;
&lt;p&gt;Read more about why we recommend migrating to &lt;a href=&#34;/blog/2024/04/09/grafana-alloy-opentelemetry-collector-with-prometheus-pipelines/&#34;&gt;Grafana Alloy&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This section provides links to documentation for how to migrate to Alloy.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/alloy/v3.0.x/tasks/migrate/from-otelcol/&#34;&gt;Migrate from OpenTelemetry Collector&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/alloy/v3.0.x/tasks/migrate/from-prometheus/&#34;&gt;Migrate from Prometheus&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/alloy/v3.0.x/tasks/migrate/from-promtail/&#34;&gt;Migrate from Promtail&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="migrate-to-alloy">Migrate to Alloy&lt;/h1>
&lt;p>Grafana Labs has provided tools and migration documentation to assist you in migrating to Grafana Alloy.&lt;/p>
&lt;p>Read more about why we recommend migrating to &lt;a href="/blog/2024/04/09/grafana-alloy-opentelemetry-collector-with-prometheus-pipelines/">Grafana Alloy&lt;/a>.&lt;/p></description></item><item><title>Set up Alloy to remote-write to Tempo</title><link>https://grafana.com/docs/tempo/v3.0.x/set-up-for-tracing/instrument-send/set-up-collector/grafana-alloy/remote-write-tempo/</link><pubDate>Thu, 28 May 2026 17:50:33 +0100</pubDate><guid>https://grafana.com/docs/tempo/v3.0.x/set-up-for-tracing/instrument-send/set-up-collector/grafana-alloy/remote-write-tempo/</guid><content><![CDATA[&lt;h1 id=&#34;set-up-alloy-to-remote-write-to-tempo&#34;&gt;Set up Alloy to remote-write to Tempo&lt;/h1&gt;


&lt;div data-shared=&#34;alloy-remote-write-tempo.md&#34;&gt;
            &lt;!-- Use Alloy to remote-write traces to Tempo shared file. --&gt;
&lt;p&gt;This section uses a 
    &lt;a href=&#34;/docs/alloy/v2.10.x/set-up/install/kubernetes/&#34;&gt;Grafana Alloy Helm chart&lt;/a&gt; deployment to send traces to Tempo.&lt;/p&gt;
&lt;p&gt;To do this, you need to create a configuration that can be used by Alloy to receive and export traces in OTLP &lt;code&gt;protobuf&lt;/code&gt; format.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a new &lt;code&gt;values.yaml&lt;/code&gt; file which we&amp;rsquo;ll use as part of the Alloy install.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Edit the &lt;code&gt;values.yaml&lt;/code&gt; file and add the following configuration to it:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;alloy:
  extraPorts:
    - name: otlp-grpc
      port: 4317
      targetPort: 4317
      protocol: TCP
  configMap:
    create: true
    content: |-
      // Creates a receiver for OTLP gRPC.
      // You can easily add receivers for other protocols by using the correct component
      // from the reference list at: https://grafana.com/docs/alloy/latest/reference/components/
      otelcol.receiver.otlp &amp;#34;otlp_receiver&amp;#34; {
        // Listen on all available bindable addresses on port 4317 (which is the
        // default OTLP gRPC port) for the OTLP protocol.
        grpc {
          endpoint = &amp;#34;0.0.0.0:4317&amp;#34;
        }

        // Output straight to the OTLP gRPC exporter. We would usually do some processing
        // first, most likely batch processing, but for this example we pass it straight
        // through.
        output {
          traces = [
            otelcol.exporter.otlp.tempo.input,
          ]
        }
      }

      // Define an OTLP gRPC exporter to send all received traces to Tempo.
      // The unique label &amp;#39;tempo&amp;#39; is added to uniquely identify this exporter.
      otelcol.exporter.otlp &amp;#34;tempo&amp;#34; {
          // Define the client for exporting.
          client {
             // Send to the Tempo distributor on port 4317 (OTLP gRPC).
             endpoint = &amp;#34;distributor.tempo.svc.cluster.local:4317&amp;#34;
              // Disable TLS for OTLP export.
              tls {
                  // The connection is insecure.
                  insecure = true
                  // Do not verify TLS certificates when connecting.
                  insecure_skip_verify = true
              }
          }
      }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Update the distributor endpoint to match your deployment. The service name and namespace depend on how you deployed Tempo:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Tanka: &lt;code&gt;distributor.&amp;lt;NAMESPACE&amp;gt;.svc.cluster.local:4317&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Helm: &lt;code&gt;&amp;lt;RELEASE-NAME&amp;gt;-distributor.&amp;lt;NAMESPACE&amp;gt;.svc.cluster.local:4317&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Deploy Alloy using Helm:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;helm install -f values.yaml grafana-alloy grafana/alloy&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you deploy Alloy into a specific namespace, create the namespace first and specify it to Helm by appending &lt;code&gt;--namespace=&amp;lt;grafana-alloy-namespace&amp;gt;&lt;/code&gt; to the end of the command.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;

        
]]></content><description>&lt;h1 id="set-up-alloy-to-remote-write-to-tempo">Set up Alloy to remote-write to Tempo&lt;/h1>
&lt;div data-shared="alloy-remote-write-tempo.md">
&lt;!-- Use Alloy to remote-write traces to Tempo shared file. -->
&lt;p>This section uses a
&lt;a href="/docs/alloy/v2.10.x/set-up/install/kubernetes/">Grafana Alloy Helm chart&lt;/a> deployment to send traces to Tempo.&lt;/p></description></item><item><title>Automatic logging: trace discovery through logs</title><link>https://grafana.com/docs/tempo/v3.0.x/set-up-for-tracing/instrument-send/set-up-collector/grafana-alloy/automatic-logging/</link><pubDate>Thu, 28 May 2026 17:50:33 +0100</pubDate><guid>https://grafana.com/docs/tempo/v3.0.x/set-up-for-tracing/instrument-send/set-up-collector/grafana-alloy/automatic-logging/</guid><content><![CDATA[&lt;h1 id=&#34;automatic-logging-trace-discovery-through-logs&#34;&gt;Automatic logging: trace discovery through logs&lt;/h1&gt;
&lt;p&gt;When you run instrumented distributed systems, discovering which traces exist can be challenging.
Grafana Alloy&amp;rsquo;s automatic logging solves this by writing well-formatted log lines for each span, root, or process that passes through the tracing pipeline.&lt;/p&gt;
&lt;p&gt;Automatic logging lets you discover trace IDs through log messages.
You can search for traces by key-value pairs in Loki and jump from a log message directly to the trace view in Grafana.&lt;/p&gt;
&lt;h2 id=&#34;automatic-logging-versus-traceql&#34;&gt;Automatic logging versus TraceQL&lt;/h2&gt;
&lt;p&gt;Tempo&amp;rsquo;s native search now provides the same trace discovery capabilities as automatic logging, without requiring a Loki instance or generating additional log volume.

    &lt;a href=&#34;/docs/tempo/v3.0.x/traceql/&#34;&gt;TraceQL&lt;/a&gt; can search traces by service name, span name, duration, status, and custom attributes.
For a visual, query-free approach, use 
    &lt;a href=&#34;/docs/grafana/next/explore/simplified-exploration/traces/&#34;&gt;Traces Drilldown&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Automatic logging is still useful if your workflow centers on Loki: trace IDs and span metadata appear alongside your application logs, letting you discover traces while investigating log data rather than switching to a separate trace search.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;To use automatic logging, you need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/alloy/v3.0.x/&#34;&gt;Grafana Alloy&lt;/a&gt; installed and receiving traces from your application.&lt;/li&gt;
&lt;li&gt;A Loki instance to store the generated logs.&lt;/li&gt;
&lt;li&gt;A Tempo instance to store traces so you can navigate from logs to traces.&lt;/li&gt;
&lt;li&gt;Grafana configured with both a 
    &lt;a href=&#34;/docs/grafana/next/datasources/loki/&#34;&gt;Loki data source&lt;/a&gt; and a 
    &lt;a href=&#34;/docs/grafana/next/datasources/tempo/&#34;&gt;Tempo data source&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;configure-automatic-logging&#34;&gt;Configure automatic logging&lt;/h2&gt;
&lt;p&gt;Automatic logging uses the &lt;code&gt;otelcol.connector.spanlogs&lt;/code&gt; connector to generate log lines from trace spans.
The connector accepts traces and generates logs, but it doesn&amp;rsquo;t forward the original traces.
You must send traces to both the &lt;code&gt;spanlogs&lt;/code&gt; connector and your trace backend to avoid losing trace data.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;../automatic-logging-pipeline.svg&#34;
  alt=&#34;Automatic logging pipeline showing traces fanning out from the OTLP receiver to both the spanlogs connector and the trace exporter.&#34;/&gt;&lt;/p&gt;
&lt;p&gt;For high-throughput systems, logging every span may generate too much volume.
In those cases, log per root span or process instead.&lt;/p&gt;
&lt;p&gt;The connector searches for a set of span or resource attributes in the spans and logs them as key-value pairs.
You can then search by those key-value pairs in Loki.&lt;/p&gt;
&lt;p&gt;For all available configuration options, refer to the &lt;code&gt;otelcol.connector.spanlogs&lt;/code&gt; 
    &lt;a href=&#34;/docs/alloy/v3.0.x/reference/components/otelcol/otelcol.connector.spanlogs/&#34;&gt;component reference&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;log-roots-to-an-otlp-endpoint&#34;&gt;Log roots to an OTLP endpoint&lt;/h3&gt;
&lt;p&gt;This example logs root spans and sends the generated logs to an OTLP endpoint.
Traces are forwarded to the same endpoint so they aren&amp;rsquo;t lost:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;otelcol.receiver.otlp &amp;#34;default&amp;#34; {
  grpc {}
  http {}

  output {
    traces = [
      otelcol.connector.spanlogs.default.input,
      otelcol.exporter.otlp.default.input,
    ]
  }
}

otelcol.connector.spanlogs &amp;#34;default&amp;#34; {
  roots = true

  output {
    logs = [otelcol.exporter.otlp.default.input]
  }
}

otelcol.exporter.otlp &amp;#34;default&amp;#34; {
  client {
    endpoint = env(&amp;#34;OTLP_ENDPOINT&amp;#34;)
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;log-roots-with-custom-attributes-to-loki&#34;&gt;Log roots with custom attributes to Loki&lt;/h3&gt;
&lt;p&gt;This example logs root spans with &lt;code&gt;http.method&lt;/code&gt; and &lt;code&gt;http.target&lt;/code&gt; attributes, then sends the generated logs to a Loki instance.
Traces are forwarded separately to a Tempo instance.&lt;/p&gt;
&lt;p&gt;Because &lt;code&gt;otelcol.exporter.loki&lt;/code&gt; doesn&amp;rsquo;t promote log attributes to Loki labels by default,
you must use &lt;code&gt;otelcol.processor.attributes&lt;/code&gt; to add a &lt;code&gt;loki.attribute.labels&lt;/code&gt; hint.
This promotes the &lt;code&gt;traces&lt;/code&gt; attribute to a Loki label so you can filter by log type:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;otelcol.receiver.otlp &amp;#34;default&amp;#34; {
  grpc {}
  http {}

  output {
    traces = [
      otelcol.connector.spanlogs.default.input,
      otelcol.exporter.otlp.tempo.input,
    ]
  }
}

otelcol.connector.spanlogs &amp;#34;default&amp;#34; {
  roots           = true
  span_attributes = [&amp;#34;http.method&amp;#34;, &amp;#34;http.target&amp;#34;]

  output {
    logs = [otelcol.processor.attributes.default.input]
  }
}

otelcol.processor.attributes &amp;#34;default&amp;#34; {
  action {
    key    = &amp;#34;loki.attribute.labels&amp;#34;
    action = &amp;#34;insert&amp;#34;
    value  = &amp;#34;traces&amp;#34;
  }

  output {
    logs = [otelcol.exporter.loki.default.input]
  }
}

otelcol.exporter.loki &amp;#34;default&amp;#34; {
  forward_to = [loki.write.local.receiver]
}

loki.write &amp;#34;local&amp;#34; {
  endpoint {
    url = &amp;#34;http://loki:3100/loki/api/v1/push&amp;#34;
  }
}

otelcol.exporter.otlp &amp;#34;tempo&amp;#34; {
  client {
    endpoint = &amp;#34;tempo:4317&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;expected-output&#34;&gt;Expected output&lt;/h2&gt;
&lt;p&gt;When you enable automatic logging, the connector generates a log line for each span, root, or process depending on which options you enable.
Each log line uses a &lt;code&gt;logfmt&lt;/code&gt;-style body with the following default keys:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Key&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;svc&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The service name from the span&amp;rsquo;s resource.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;span&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The name of the span.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;dur&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The duration of the span in nanoseconds, for example, &lt;code&gt;150200000ns&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;tid&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The trace ID.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;status&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The status of the span. Only included when the status is explicitly set (not &lt;code&gt;STATUS_CODE_UNSET&lt;/code&gt;). Values are &lt;code&gt;STATUS_CODE_OK&lt;/code&gt; or &lt;code&gt;STATUS_CODE_ERROR&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;You can add more keys by configuring &lt;code&gt;span_attributes&lt;/code&gt;, &lt;code&gt;process_attributes&lt;/code&gt;, or &lt;code&gt;event_attributes&lt;/code&gt;.
You can customize all key names using the &lt;code&gt;overrides&lt;/code&gt; block.
For details, refer to the &lt;code&gt;otelcol.connector.spanlogs&lt;/code&gt; 
    &lt;a href=&#34;/docs/alloy/v3.0.x/reference/components/otelcol/otelcol.connector.spanlogs/&#34;&gt;component reference&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For example, a root span log line might look like this:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;span=&amp;#34;HTTP GET&amp;#34; dur=150200000ns http.method=GET http.target=/api/v1/query svc=my-service tid=7bba9f33312b3dbb8b2c2c62bb7abe2d&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Each log line also has a &lt;code&gt;traces&lt;/code&gt; attribute that indicates the log type: &lt;code&gt;span&lt;/code&gt;, &lt;code&gt;root&lt;/code&gt;, &lt;code&gt;process&lt;/code&gt;, or &lt;code&gt;event&lt;/code&gt;.
If you configured the &lt;code&gt;loki.attribute.labels&lt;/code&gt; hint as shown in the Loki example, this attribute becomes a Loki label that you can filter on.&lt;/p&gt;
&lt;h3 id=&#34;query-automatic-logging-data-in-loki&#34;&gt;Query automatic logging data in Loki&lt;/h3&gt;
&lt;p&gt;Use LogQL in Grafana Explore to query the generated logs.&lt;/p&gt;
&lt;p&gt;To find all root span logs:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;{traces=&amp;#34;root&amp;#34;}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To filter for slow requests from a specific service:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;{traces=&amp;#34;root&amp;#34;} | logfmt | dur &amp;gt; 2s and svc=&amp;#34;my-service&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;traceql-equivalents&#34;&gt;TraceQL equivalents&lt;/h3&gt;
&lt;p&gt;The following TraceQL queries provide the same trace discovery as the LogQL queries above, without requiring automatic logging or a Loki instance.&lt;/p&gt;
&lt;p&gt;To find all traces from a specific service:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;traceql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-traceql&#34;&gt;{ resource.service.name = &amp;#34;my-service&amp;#34; }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To find slow traces (duration over 2 seconds) from a specific service:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;traceql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-traceql&#34;&gt;{ resource.service.name = &amp;#34;my-service&amp;#34; &amp;amp;&amp;amp; span:duration &amp;gt; 2s }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To find error traces:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;traceql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-traceql&#34;&gt;{ status = error }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To search by a specific attribute:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;traceql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-traceql&#34;&gt;{ span.http.method = &amp;#34;GET&amp;#34; &amp;amp;&amp;amp; span.http.target = &amp;#34;/api/v1/query&amp;#34; }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Refer to 
    &lt;a href=&#34;/docs/tempo/v3.0.x/traceql/construct-traceql-queries/&#34;&gt;Construct TraceQL queries&lt;/a&gt; for the full query syntax.&lt;/p&gt;
&lt;h3 id=&#34;navigate-from-logs-to-traces&#34;&gt;Navigate from logs to traces&lt;/h3&gt;
&lt;p&gt;To link from a log line directly to its trace in Tempo, configure 
    &lt;a href=&#34;/docs/grafana/next/datasources/loki/configure-loki-data-source/#derived-fields&#34;&gt;derived fields&lt;/a&gt; on your Loki data source in Grafana:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;Connections&lt;/strong&gt; &amp;gt; &lt;strong&gt;Data sources&lt;/strong&gt; and select your Loki data source.&lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;Derived fields&lt;/strong&gt;, add a new field with these settings:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Name&lt;/strong&gt;: &lt;code&gt;TraceID&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;/strong&gt;: &lt;strong&gt;Label&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Match field name&lt;/strong&gt;: &lt;code&gt;tid&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Internal link&lt;/strong&gt; enabled, pointing to your Tempo data source&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Save the data source configuration.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After this configuration, log results in Explore display a link next to the &lt;code&gt;tid&lt;/code&gt; field.&lt;/p&gt;
]]></content><description>&lt;h1 id="automatic-logging-trace-discovery-through-logs">Automatic logging: trace discovery through logs&lt;/h1>
&lt;p>When you run instrumented distributed systems, discovering which traces exist can be challenging.
Grafana Alloy&amp;rsquo;s automatic logging solves this by writing well-formatted log lines for each span, root, or process that passes through the tracing pipeline.&lt;/p></description></item></channel></rss>