<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Configure Grafana Agent on Grafana Labs</title><link>https://grafana.com/docs/agent/v0.31/configuration/</link><description>Recent content in Configure Grafana Agent on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/agent/v0.31/configuration/index.xml" rel="self" type="application/rss+xml"/><item><title>Create a config file</title><link>https://grafana.com/docs/agent/v0.31/configuration/create-config-file/</link><pubDate>Sat, 11 Apr 2026 09:32:03 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.31/configuration/create-config-file/</guid><content><![CDATA[&lt;h1 id=&#34;create-a-configuration-file&#34;&gt;Create a configuration file&lt;/h1&gt;
&lt;p&gt;The Grafana Agent supports configuring multiple independent &amp;ldquo;subsystems.&amp;rdquo; Each
subsystem helps you collect data for a specific type of telemetry.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Metrics&lt;/strong&gt; subsystem allows you collect metrics to send to Prometheus.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Logs&lt;/strong&gt; subsystem allows you to collect logs to send to Grafana Loki.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Traces&lt;/strong&gt; subsystem allows you to collect spans to send to Grafana Tempo.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Integrations&lt;/strong&gt; subsystem allows you to collect metrics for common
applications, such as MySQL.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Integrations are recommended for first-time users of observability platforms,
especially newcomers to Prometheus. Users with more experience with Prometheus
or users that already have an existing Prometheus config file can configure
the Prometheus subsystem manually.&lt;/p&gt;
&lt;h2 id=&#34;integrations&#34;&gt;Integrations&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Integrations&lt;/em&gt; are individual features that collect metrics for you. For
example, the &lt;code&gt;agent&lt;/code&gt; integration collects metrics from that running instance of
the Grafana Agent. The &lt;code&gt;node_exporter&lt;/code&gt; integration will collect metrics from the
Linux machine that the Grafana Agent is running on.&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;metrics:
  wal_directory: /tmp/wal
  global:
    remote_write:
      - url: http://localhost:9009/api/prom/push

integrations:
  agent:
    enabled: true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, we first must configure the &lt;code&gt;wal_directory&lt;/code&gt; which is used to
store metrics in a Write-Ahead Log. This is required, but ensures that samples
will be resent in case of failure (e.g., network issues, machine reboot). We
also configure &lt;code&gt;remote_write&lt;/code&gt;, which is where all metrics should be sent by
default.&lt;/p&gt;
&lt;p&gt;Then, the individual &lt;code&gt;integrations&lt;/code&gt; are configured. In this example, just the
&lt;code&gt;agent&lt;/code&gt; integration is enabled. Finally, &lt;code&gt;prometheus_remote_write&lt;/code&gt; is configured
with a location to send metrics. You will have to replace this URL with the
appropriate URL for your &lt;code&gt;remote_write&lt;/code&gt; system (such as a Grafana Cloud Hosted
Prometheus instance).&lt;/p&gt;
&lt;p&gt;When the Agent is run with this file, it will collect metrics from itself and
send those metrics to the default &lt;code&gt;remote_write&lt;/code&gt; endpoint. All metrics from
integrations will have an &lt;code&gt;instance&lt;/code&gt; label matching the hostname of the machine
the Grafana Agent is running on. This label helps to uniquely identify the
source of metrics if you are running multiple Grafana Agents across multiple
machines.&lt;/p&gt;
&lt;p&gt;Full configuration options can be found in the
&lt;a href=&#34;../&#34;&gt;configuration reference&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;prometheus-configmigrating-from-prometheus&#34;&gt;Prometheus config/migrating from Prometheus&lt;/h2&gt;
&lt;p&gt;The Prometheus subsystem config is useful for those migrating from Prometheus
and those who want to scrape metrics from something that currently does not have
an associated integration.&lt;/p&gt;
&lt;p&gt;To migrate from an existing Prometheus config, use this Agent config as a
template and copy and paste subsections from your existing Prometheus config
into 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;metrics:
  global:
  # PASTE PROMETHEUS global SECTION HERE
  configs:
    - name: agent
      scrape_configs:
        # PASTE scrape_configs SECTION HERE
      remote_write:
        # PASTE remote_write SECTION HERE&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For example, this configuration file configures the Grafana Agent to
scrape itself without using the integration:&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;server:
  log_level: info

metrics:
  global:
    scrape_interval: 1m
  configs:
    - name: agent
      scrape_configs:
        - job_name: agent
          static_configs:
            - targets: [&amp;#39;127.0.0.1:12345&amp;#39;]
      remote_write:
        - url: http://localhost:9009/api/prom/push&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Like with integrations, full configuration options can be found in the
&lt;a href=&#34;../&#34;&gt;configuration&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;loki-configmigrating-from-promtail&#34;&gt;Loki Config/Migrating from Promtail&lt;/h2&gt;
&lt;p&gt;The Loki Config allows for collecting logs to send to a Loki API. Users that are
familiar with Promtail will notice that the Loki config for the Agent matches
their existing Promtail config with the following exceptions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The deprecated field &lt;code&gt;client&lt;/code&gt; is not present&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;server&lt;/code&gt; field is not present&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To migrate from an existing Promtail config, make sure you are using &lt;code&gt;clients&lt;/code&gt;
instead of &lt;code&gt;client&lt;/code&gt; and remove the &lt;code&gt;server&lt;/code&gt; block if present. Then paste your
Promtail config into the Agent config file inside of a &lt;code&gt;logs&lt;/code&gt; section:&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;logs:
  configs:
  - name: default
    # PASTE YOUR PROMTAIL CONFIG INSIDE OF HERE&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;full-config-example&#34;&gt;Full config example&lt;/h3&gt;
&lt;p&gt;Here is an example full config file, using integrations, Prometheus, Loki, and
Tempo:&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;server:
  log_level: info

metrics:
  global:
    scrape_interval: 1m
    remote_write:
      - url: http://localhost:9009/api/prom/push
  configs:
    - name: default
      scrape_configs:
        - job_name: agent
          static_configs:
            - targets: [&amp;#39;127.0.0.1:12345&amp;#39;]

logs:
  configs:
  - name: default
    positions:
      filename: /tmp/positions.yaml
    scrape_configs:
      - job_name: varlogs
        static_configs:
          - targets: [localhost]
            labels:
              job: varlogs
              __path__: /var/log/*log
    clients:
      - url: http://localhost:3100/loki/api/v1/push

traces:
  configs:
  - name: default
    receivers:
      jaeger:
        protocols:
          grpc: # listens on the default jaeger grpc port: 14250
    remote_write:
      - endpoint: localhost:55680
        insecure: true  # only add this if TLS is not required
    batch:
      timeout: 5s
      send_batch_size: 100

integrations:
  node_exporter:
    enabled: true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="create-a-configuration-file">Create a configuration file&lt;/h1>
&lt;p>The Grafana Agent supports configuring multiple independent &amp;ldquo;subsystems.&amp;rdquo; Each
subsystem helps you collect data for a specific type of telemetry.&lt;/p>
&lt;ul>
&lt;li>The &lt;strong>Metrics&lt;/strong> subsystem allows you collect metrics to send to Prometheus.&lt;/li>
&lt;li>The &lt;strong>Logs&lt;/strong> subsystem allows you to collect logs to send to Grafana Loki.&lt;/li>
&lt;li>The &lt;strong>Traces&lt;/strong> subsystem allows you to collect spans to send to Grafana Tempo.&lt;/li>
&lt;li>The &lt;strong>Integrations&lt;/strong> subsystem allows you to collect metrics for common
applications, such as MySQL.&lt;/li>
&lt;/ul>
&lt;p>Integrations are recommended for first-time users of observability platforms,
especially newcomers to Prometheus. Users with more experience with Prometheus
or users that already have an existing Prometheus config file can configure
the Prometheus subsystem manually.&lt;/p></description></item><item><title>Command-line flags</title><link>https://grafana.com/docs/agent/v0.31/configuration/flags/</link><pubDate>Sat, 11 Apr 2026 09:32:03 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.31/configuration/flags/</guid><content><![CDATA[&lt;h1 id=&#34;command-line-flags&#34;&gt;Command-line flags&lt;/h1&gt;
&lt;p&gt;Command-line flags are used to configure settings of Grafana Agent which cannot
be updated at runtime.&lt;/p&gt;
&lt;p&gt;All flags may be prefixed with either one hypen or two (i.e., both
&lt;code&gt;-config.file&lt;/code&gt; and &lt;code&gt;--config.file&lt;/code&gt; are valid).&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: There may be flags returned by &lt;code&gt;-help&lt;/code&gt; which are not listed here; this
document only lists flags that do not have an equivalent in the YAML file.&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;basic&#34;&gt;Basic&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-version&lt;/code&gt;: Print out version information&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-help&lt;/code&gt;: Print out help&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;experimental-feature-flags&#34;&gt;Experimental feature flags&lt;/h2&gt;
&lt;p&gt;Grafana Agent has some experimental features that require being enabled through
an &lt;code&gt;-enable-features&lt;/code&gt; flag. This flag takes a comma-delimited list of feature
names to enable.&lt;/p&gt;
&lt;p&gt;Valid feature names are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;remote-configs&lt;/code&gt;: Enable &lt;a href=&#34;./#remote-configuration-experimental&#34;&gt;retrieving&lt;/a&gt; config files over HTTP/HTTPS&lt;/li&gt;
&lt;li&gt;&lt;code&gt;integrations-next&lt;/code&gt;: Enable &lt;a href=&#34;../integrations/integrations-next/&#34;&gt;revamp&lt;/a&gt; of the integrations subsystem&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dynamic-config&lt;/code&gt;: Enable support for &lt;a href=&#34;../dynamic-config/&#34;&gt;dynamic configuration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;extra-scrape-metrics&lt;/code&gt;: When enabled, additional time series  are exposed for each metrics instance scrape. See &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/feature_flags/#extra-scrape-metrics&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Extra scrape metrics&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;report-information-usage&#34;&gt;Report information usage&lt;/h2&gt;
&lt;p&gt;By default, Grafana Agent sends anonymous, but uniquely-identifiable usage information
from your running Grafana Agent instance to Grafana Labs.
These statistics are sent to &lt;code&gt;stats.grafana.org&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Statistics help us better understand how Grafana Agent is used.
This helps us prioritize features and documentation.&lt;/p&gt;
&lt;p&gt;The usage information includes the following details:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A randomly generated and an anonymous unique ID (UUID).&lt;/li&gt;
&lt;li&gt;Timestamp of when the UID was first generated.&lt;/li&gt;
&lt;li&gt;Timestamp of when the report was created (by default, every 4h).&lt;/li&gt;
&lt;li&gt;Version of running Grafana Agent.&lt;/li&gt;
&lt;li&gt;Operating system Grafana Agent is running on.&lt;/li&gt;
&lt;li&gt;System architecture Grafana Agent is running on.&lt;/li&gt;
&lt;li&gt;List of enabled feature flags.&lt;/li&gt;
&lt;li&gt;List of enabled integrations.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This list may change over time. All newly reported data will also be documented in the CHANGELOG.&lt;/p&gt;
&lt;p&gt;If you would like to disable the reporting, Grafana Agent provides the flag &lt;code&gt;-disable-reporting&lt;/code&gt;
to stop the reporting.&lt;/p&gt;
&lt;h2 id=&#34;support-bundles&#34;&gt;Support bundles&lt;/h2&gt;
&lt;p&gt;Grafana Agent allows the exporting of &amp;lsquo;support bundles&amp;rsquo; on the &lt;code&gt;/-/support&lt;/code&gt;
endpoint. Support bundles are zip files containing commonly-used information
that provide a baseline for debugging issues with the Agent.&lt;/p&gt;
&lt;p&gt;Support bundles contain all information in plain text, so that they can be
inspected before sharing to verify that no sensitive information has leaked.&lt;/p&gt;
&lt;p&gt;Support bundles contain the following data:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;agent-config.yaml&lt;/code&gt; contains the current agent configuration (when the &lt;code&gt;-config.enable-read-api&lt;/code&gt; flag is passed).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;agent-logs.txt&lt;/code&gt; contains the agent logs during the bundle generation.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;agent-metadata.yaml&lt;/code&gt; contains the agent&amp;rsquo;s build version, operating system, architecture, uptime, plus a string payload defining which extra agent features have been enabled via command-line flags.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;agent-metrics-instances.json&lt;/code&gt; and &lt;code&gt;agent-metrics-targets.json&lt;/code&gt; contain the active metric subsystem instances, and the discovered scraped targets for each one.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;agent-logs-instances.json&lt;/code&gt; contains the active logs subsystem instances.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;agent-metrics.txt&lt;/code&gt; contains a snapshot of the agent&amp;rsquo;s internal metrics.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;pprof/&lt;/code&gt; directory contains Go runtime profiling data (CPU, heap, goroutine, mutex, block profiles) as exported by the pprof package.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To disable the endpoint that exports these support bundles, you can pass in the
&lt;code&gt;-disable-support-bundle&lt;/code&gt; command-line flag.&lt;/p&gt;
&lt;h2 id=&#34;configuration-file&#34;&gt;Configuration file&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-config.file&lt;/code&gt;: Path to the configuration file to load. May be an HTTP(s) URL when the &lt;code&gt;remote-configs&lt;/code&gt; feature is enabled.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-config.file.type&lt;/code&gt;: Type of file which &lt;code&gt;-config.file&lt;/code&gt; refers to (default &lt;code&gt;yaml&lt;/code&gt;). Valid values are &lt;code&gt;yaml&lt;/code&gt; and &lt;code&gt;dynamic&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-config.expand-env&lt;/code&gt;: Expand environment variables in the loaded configuration file&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-config.enable-read-api&lt;/code&gt;: Enables the &lt;code&gt;/-/config&lt;/code&gt; and &lt;code&gt;/agent/api/v1/configs/{name}&lt;/code&gt; API endpoints to print YAML configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remote-configuration&#34;&gt;Remote Configuration&lt;/h3&gt;
&lt;p&gt;These flags require the &lt;code&gt;remote-configs&lt;/code&gt; feature to be enabled:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;-config.url.basic-auth-user&lt;/code&gt;: Basic Authentication username to use when fetching the remote configuration file
&lt;code&gt;-config.url.basic-auth-password-file&lt;/code&gt;: File containing a Basic Authentication password to use when fetching the remote configuration file&lt;/p&gt;
&lt;h3 id=&#34;dynamic-configuration&#34;&gt;Dynamic Configuration&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;dynamic-config&lt;/code&gt; and &lt;code&gt;integrations-next&lt;/code&gt; features must be enabled when
&lt;code&gt;-config.file.type&lt;/code&gt; is set to &lt;code&gt;dynamic&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;server&#34;&gt;Server&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-server.register-instrumentation&lt;/code&gt;: Expose the &lt;code&gt;/metrics&lt;/code&gt; and &lt;code&gt;/debug/pprof/&lt;/code&gt; instrumentation handlers over HTTP (default true)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.graceful-shutdown-timeout&lt;/code&gt;: Timeout for a graceful server shutdown&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.log.source-ips.enabled&lt;/code&gt;: Whether to log IP addresses of incoming requests&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.log.source-ips.header&lt;/code&gt;: Header field to extract incoming IP requests from (defaults to Forwarded, X-Real-IP, X-Forwarded-For)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.log.source-ips.regex&lt;/code&gt;: Regex to extract the IP out of the read header, using the first capture group as the IP address&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.http.network&lt;/code&gt;: HTTP server listen network (default &lt;code&gt;tcp&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.http.address&lt;/code&gt;: HTTP server listen:port (default &lt;code&gt;127.0.0.1:12345&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.http.enable-tls&lt;/code&gt;: Enable TLS for the HTTP server&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.http.conn-limit&lt;/code&gt;: Maximum number of simultaneous HTTP connections&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.http.idle-timeout&lt;/code&gt;: HTTP server idle timeout&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.http.read-timeout&lt;/code&gt;: HTTP server read timeout&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.http.write-timeout&lt;/code&gt;: HTTP server write timeout&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.http.in-memory-addr&lt;/code&gt;: Internal address used for the agent to make
in-memory HTTP connections to itself. (default &lt;code&gt;agent.internal:12345&lt;/code&gt;) The
port number specified here is virtual and does not open a real network port.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.network&lt;/code&gt; gRPC server listen network (default &lt;code&gt;grpc&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.address&lt;/code&gt;: gRPC server listen host:port (default &lt;code&gt;127.0.0.1:12346&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.enable-tls&lt;/code&gt;: Enable TLS for the gRPC server&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.conn-limit&lt;/code&gt;: Maximum number of simultaneous gRPC connections&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.keepalive.max-connection-age&lt;/code&gt; Maximum age for any gRPC connection for a graceful shutdown&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.keepalive.max-connection-age-grace&lt;/code&gt; Grace period to forceibly close connections after a graceful shutdown starts&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.keepalive.max-connection-idle&lt;/code&gt; Time to wait before closing idle gRPC connections&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.keepalive.min-time-between-pings&lt;/code&gt; Maximum frequency that clients may send pings at&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.keepalive.ping-without-stream-allowed&lt;/code&gt; Allow clients to send pings without having a gRPC stream&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.keepalive.time&lt;/code&gt; Frequency to send keepalive pings from the server&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.keepalive.timeout&lt;/code&gt; How long to wait for a keepalive pong before closing the connection&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.max-concurrent-streams&lt;/code&gt; Maximum number of concurrent gRPC streams (0 = unlimited)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.max-recv-msg-size-bytes&lt;/code&gt; Maximum size in bytes for received gRPC messages&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.max-send-msg-size-bytes&lt;/code&gt; Maximum size in bytes for send gRPC messages&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-server.grpc.in-memory-addr&lt;/code&gt;: Internal address used for the agent to make
in-memory gRPC connections to itself. (default &lt;code&gt;agent.internal:12346&lt;/code&gt;). The
port number specified here is virtual and does not open a real network port.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;tls-support&#34;&gt;TLS Support&lt;/h3&gt;
&lt;p&gt;TLS support can be enabled with &lt;code&gt;-server.http.tls-enabled&lt;/code&gt; and
&lt;code&gt;-server.grpc.tls-enabled&lt;/code&gt; for the HTTP and gRPC servers respectively.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;server.http_tls_config&lt;/code&gt; and &lt;code&gt;integrations.http_tls_config&lt;/code&gt; must be set in the
YAML configuration when the &lt;code&gt;-server.http.tls-enabled&lt;/code&gt; flag is used.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;server.grpc_tls_config&lt;/code&gt; must be set in the YAML configuration when the
&lt;code&gt;-server.grpc.tls-enabled&lt;/code&gt; flag is used.&lt;/p&gt;
&lt;h2 id=&#34;metrics&#34;&gt;Metrics&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-metrics.wal-directory&lt;/code&gt;: Directory to store the metrics Write-Ahead Log in&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="command-line-flags">Command-line flags&lt;/h1>
&lt;p>Command-line flags are used to configure settings of Grafana Agent which cannot
be updated at runtime.&lt;/p>
&lt;p>All flags may be prefixed with either one hypen or two (i.e., both
&lt;code>-config.file&lt;/code> and &lt;code>--config.file&lt;/code> are valid).&lt;/p></description></item><item><title>server_config</title><link>https://grafana.com/docs/agent/v0.31/configuration/server-config/</link><pubDate>Sat, 11 Apr 2026 09:32:03 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.31/configuration/server-config/</guid><content><![CDATA[&lt;h1 id=&#34;server_config&#34;&gt;server_config&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;server_config&lt;/code&gt; block configures the Agent&amp;rsquo;s behavior as an HTTP server,
gRPC server, and the log level for the whole process.&lt;/p&gt;
&lt;p&gt;The Agent exposes an HTTP server for scraping its own metrics and gRPC for the
scraping service mode.&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;# Log only messages with the given severity or above. Supported values [debug,
# info, warn, error]. This level affects logging for all Agent-level logs, not
# just the HTTP and gRPC server.
#
# Note that some integrations use their own loggers which ignore this
# setting.
[log_level: &amp;lt;string&amp;gt; | default = &amp;#34;info&amp;#34;]

# Log messages with the given format. Supported values [logfmt, json].
# This affects logging for all Agent-levle logs, not just the HTTP and gRPC
# server.
#
# Note that some integrations use their own loggers which ignore this
# setting.
[log_format: &amp;lt;string&amp;gt; | default = &amp;#34;logfmt&amp;#34;]

# TLS configuration for the HTTP server. Reuqired when the
# -server.http.tls-enabled flag is provided, ignored otherwise.
[http_tls_config: &amp;lt;server_tls_config&amp;gt;]

# TLS configuration for the gRPC server. Required when the
# -server.grpc.tls-enabled flag is provided, ignored otherwise.
[grpc_tls_config: &amp;lt;server_tls_config&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;server_tls_config&#34;&gt;server_tls_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;server_tls_config&lt;/code&gt; configures TLS.&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;# File path to the server certificate
[cert_file: &amp;lt;string&amp;gt;]

# File path to the server key
[key_file: &amp;lt;string&amp;gt;]

# Tells the server what is acceptable from the client, this drives the options in client_tls_config
[client_auth_type: &amp;lt;string&amp;gt;]

# File path to the signing CA certificate, needed if CA is not trusted
[client_ca_file: &amp;lt;string&amp;gt;]

# Windows certificate filter allows selecting client CA and server certificate from the Windows Certificate store
[windows_certificate_filter: &amp;lt;windows_certificate_filter_config&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;windows_certificate_filter_config&#34;&gt;windows_certificate_filter_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;windows_certificate_filter_config&lt;/code&gt; configures the use of the Windows Certificate store. Setting cert_file, key_file, and client_ca_file are invalid settings when using the windows_certificate_filter.&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;# Client configuration, optional. If nothing specific will use the default client ca root
[client: &amp;lt;windows_client_config&amp;gt;]
  
# Name of the store to look for the Client Certificate ex My, CA
server: &amp;lt;windows_server_config&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;windows_client_config&#34;&gt;windows_client_config&lt;/h3&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;# Array of issuer common names to check against
issuer_common_names:
  [- &amp;lt;string&amp;gt; ... ]

# Regular expression to match Subject name
[subject_regex: &amp;lt;string&amp;gt;]

# Client Template ID to match in ASN1 format ex &amp;#34;1.2.3&amp;#34;
[template_id: &amp;lt;string&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;windows_server_config&#34;&gt;windows_server_config&lt;/h3&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;# Name of the system store to look for the Server Certificate ex LocalMachine, CurrentUser
system_store: &amp;lt;string&amp;gt;

# Name of the store to look for the Server Certificate ex My, CA
store: &amp;lt;string&amp;gt;

# Array of issuer common names to check against
issuer_common_names:
[- &amp;lt;string&amp;gt; ... ]


# Server Template ID to match in ASN1 format ex &amp;#34;1.2.3&amp;#34;
[template_id: &amp;lt;string&amp;gt;]

# How often to refresh the server certificate ex 5m, 1h
[refresh_interval: &amp;lt;duration&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="server_config">server_config&lt;/h1>
&lt;p>The &lt;code>server_config&lt;/code> block configures the Agent&amp;rsquo;s behavior as an HTTP server,
gRPC server, and the log level for the whole process.&lt;/p>
&lt;p>The Agent exposes an HTTP server for scraping its own metrics and gRPC for the
scraping service mode.&lt;/p></description></item><item><title>metrics_config</title><link>https://grafana.com/docs/agent/v0.31/configuration/metrics-config/</link><pubDate>Sat, 11 Apr 2026 09:32:03 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.31/configuration/metrics-config/</guid><content><![CDATA[&lt;h1 id=&#34;metrics_config&#34;&gt;metrics_config&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;metrics_config&lt;/code&gt; block is used to define a collection of metrics
instances. Each instance defines a collection of Prometheus-compatible
scrape_configs and remote_write rules. Most users will only need to
define one instance.&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;# Configures the optional scraping service to cluster agents.
[scraping_service: &amp;lt;scraping_service_config&amp;gt;]

# Configures the gRPC client used for agents to connect to other
# clustered agents.
[scraping_service_client: &amp;lt;scraping_service_client_config&amp;gt;]

# Configure values for all Prometheus instances.
[global: &amp;lt;global_config&amp;gt;]

# Configure the directory used by instances to store their WAL.
#
# The Grafana Agent assumes that all folders within wal_directory are managed by
# the agent itself. This means if you are using a PVC, you must point
# wal_directory to a subdirectory of the PVC mount.
[wal_directory: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Configures how long ago an abandoned (not associated with an instance) WAL
# may be written to before being eligible to be deleted
[wal_cleanup_age: &amp;lt;duration&amp;gt; | default = &amp;#34;12h&amp;#34;]

# Configures how often checks for abandoned WALs to be deleted are performed.
# A value of 0 disables periodic cleanup of abandoned WALs
[wal_cleanup_period: &amp;lt;duration&amp;gt; | default = &amp;#34;30m&amp;#34;]

# Allows to disable HTTP Keep-Alives when scraping; the Agent will only use
# outgoing each connection for a single request.
[http_disable_keepalives: &amp;lt;boolean&amp;gt; | default = false]

# Allows to configure the maximum amount of time an idle Keep-Alive connection
# can remain idle before closing itself. Zero means no limit.
# The setting is ignored when `http_disable_keepalives` is enabled.
[http_idle_conn_timeout: &amp;lt;duration&amp;gt; | default = &amp;#34;5m&amp;#34;]

# The list of Prometheus instances to launch with the agent.
configs:
  [- &amp;lt;metrics_instance_config&amp;gt;]

# If an instance crashes abnormally, how long should we wait before trying
# to restart it. 0s disables the backoff period and restarts the agent
# immediately.
[instance_restart_backoff: &amp;lt;duration&amp;gt; | default = &amp;#34;5s&amp;#34;]

# How to spawn instances based on instance configs. Supported values: shared,
# distinct.
[instance_mode: &amp;lt;string&amp;gt; | default = &amp;#34;shared&amp;#34;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;scraping_service_config&#34;&gt;scraping_service_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;scraping_service&lt;/code&gt; block configures the
&lt;a href=&#34;../scraping-service/&#34;&gt;scraping service&lt;/a&gt;, an operational
mode where configurations are stored centrally in a KV store and a cluster of
agents distribute discovery and scrape load between nodes.&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;# Whether to enable scraping service mode. When enabled, local configs
# cannot be used.
[enabled: &amp;lt;boolean&amp;gt; | default = false]

# Note these next 3 configuration options are confusing. Due to backwards compatibility the naming
# is less than ideal.

# How often should the agent manually refresh the configuration. Useful for if KV change
# events are not sent by an agent.
[reshard_interval: &amp;lt;duration&amp;gt; | default = &amp;#34;1m&amp;#34;]

# The timeout for configuration refreshes. This can occur on cluster events or
# on the reshard interval. A timeout of 0 indicates no timeout.
[reshard_timeout: &amp;lt;duration&amp;gt; | default = &amp;#34;30s&amp;#34;]

# The timeout for a cluster reshard events. A timeout of 0 indicates no timeout.
[cluster_reshard_event_timeout: &amp;lt;duration&amp;gt; | default = &amp;#34;30s&amp;#34;]

# Configuration for the KV store to store configurations.
kvstore: &amp;lt;kvstore_config&amp;gt;

# When set, allows configs pushed to the KV store to specify configuration
# fields that can read secrets from files.
#
# This is disabled by default. When enabled, a malicious user can craft an
# instance config that reads arbitrary files on the machine the Agent runs
# on and sends its contents to a specically crafted remote_write endpoint.
#
# If enabled, ensure that no untrusted users have access to the Agent API.
[dangerous_allow_reading_files: &amp;lt;boolean&amp;gt;]

# Configuration for how agents will cluster together.
lifecycler: &amp;lt;lifecycler_config&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;kvstore_config&#34;&gt;kvstore_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;kvstore_config&lt;/code&gt; block configures the KV store used as storage for
configurations in the scraping service mode.&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;# Which underlying KV store to use. Can be either consul or etcd
[store: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Key prefix to store all configurations with. Must end in /.
[prefix: &amp;lt;string&amp;gt; | default = &amp;#34;configurations/&amp;#34;]

# Configuration for a Consul client. Only applies if store
# is &amp;#34;consul&amp;#34;
consul:
  # The hostname and port of Consul.
  [host: &amp;lt;string&amp;gt; | duration = &amp;#34;localhost:8500&amp;#34;]

  # The ACL Token used to interact with Consul.
  [acltoken: &amp;lt;string&amp;gt;]

  # The HTTP timeout when communicating with Consul
  [httpclienttimeout: &amp;lt;duration&amp;gt; | default = 20s]

  # Whether or not consistent reads to Consul are enabled.
  [consistentreads: &amp;lt;boolean&amp;gt; | default = true]

# Configuration for an ETCD v3 client. Only applies if
# store is &amp;#34;etcd&amp;#34;
etcd:
  # The ETCD endpoints to connect to.
  endpoints:
    - &amp;lt;string&amp;gt;

  # The Dial timeout for the ETCD connection.
  [dial_tmeout: &amp;lt;duration&amp;gt; | default = 10s]

  # The maximum number of retries to do for failed ops to ETCD.
  [max_retries: &amp;lt;int&amp;gt; | default = 10]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;lifecycler_config&#34;&gt;lifecycler_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;lifecycler_config&lt;/code&gt; block configures the lifecycler; the component that
Agents use to cluster together.&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;# Configures the distributed hash ring storage.
ring:
  # KV store for getting and sending distributed hash ring updates.
  kvstore: &amp;lt;kvstore_config&amp;gt;

  # Specifies when other agents in the clsuter should be considered
  # unhealthy if they haven&amp;#39;t sent a heartbeat within this duration.
  [heartbeat_timeout: &amp;lt;duration&amp;gt; | default = &amp;#34;1m&amp;#34;]

# Number of tokens to generate for the distributed hash ring.
[num_tokens: &amp;lt;int&amp;gt; | default = 128]

# How often agents should send a heartbeat to the distributed hash
# ring.
[heartbeat_period: &amp;lt;duration&amp;gt; | default = &amp;#34;5s&amp;#34;]

# How long to wait for tokens from other agents after generating
# a new set to resolve collisions. Useful only when using a gossip
# KV store.
[observe_period: &amp;lt;duration&amp;gt; | default = &amp;#34;0s&amp;#34;]

# Period to wait before joining the ring. 0s means to join immediately.
[join_after: &amp;lt;duration&amp;gt; | default = &amp;#34;0s&amp;#34;]

# Minimum duration to wait before marking the agent as ready to receive
# traffic. Used to work around race conditions for multiple agents exiting
# the distributed hash ring at the same time.
[min_ready_duration: &amp;lt;duration&amp;gt; | default = &amp;#34;1m&amp;#34;]

# Network interfaces to resolve addresses defined by other agents
# registered in distributed hash ring.
[interface_names: &amp;lt;string array&amp;gt; | default = [&amp;#34;eth0&amp;#34;, &amp;#34;en0&amp;#34;]]

# Duration to sleep before exiting. Ensures that metrics get scraped
# before the process quits.
[final_sleep: &amp;lt;duration&amp;gt; | default = &amp;#34;30s&amp;#34;]

# File path to store tokens. If empty, tokens will not be stored during
# shutdown and will not be restored at startup.
[tokens_file_path: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Availability zone of the host the agent is running on. Default is an
# empty string which disables zone awareness for writes.
[availability_zone: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;scraping_service_client_config&#34;&gt;scraping_service_client_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;scraping_service_client_config&lt;/code&gt; block configures how clustered Agents will
generate gRPC clients to connect to each other.&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;grpc_client_config:
  # Maximum size in bytes the gRPC client will accept from the connected server.
  [max_recv_msg_size: &amp;lt;int&amp;gt; | default = 104857600]

  # Maximum size in bytes the gRPC client will sent to the connected server.
  [max_send_msg_size: &amp;lt;int&amp;gt; | default = 16777216]

  # Whether messages should be gzipped.
  [use_gzip_compression: &amp;lt;boolean&amp;gt; | default = false]

  # The rate limit for gRPC clients; 0 means no rate limit.
  [rate_limit: &amp;lt;float64&amp;gt; | default = 0]

  # gRPC burst allowed for rate limits.
  [rate_limit_burst: &amp;lt;int&amp;gt; | default = 0]

  # Controls if when a rate limit is hit whether the client should
  # retry the request.
  [backoff_on_ratelimits: &amp;lt;boolean&amp;gt; | default = false]

  # Configures the retry backoff when backoff_on_ratelimits is
  # true.
  backoff_config:
    # The minimum delay when backing off.
    [min_period: &amp;lt;duration&amp;gt; | default = &amp;#34;100ms&amp;#34;]

    # The maximum delay when backing off.
    [max_period: &amp;lt;duration&amp;gt; | default = &amp;#34;10s&amp;#34;]

    # The number of times to backoff and retry before failing.
    [max_retries: &amp;lt;int&amp;gt; | default = 10]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;global_config&#34;&gt;global_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;global_config&lt;/code&gt; block configures global values for all launched Prometheus
instances.&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;# How frequently should Prometheus instances scrape.
[scrape_interval: duration | default = &amp;#34;1m&amp;#34;]

# How long to wait before timing out a scrape from a target.
[scrape_timeout: duration | default = &amp;#34;10s&amp;#34;]

# A list of static labels to add for all metrics.
external_labels:
  { &amp;lt;string&amp;gt;: &amp;lt;string&amp;gt; }

# Default set of remote_write endpoints. If an instance doesn&amp;#39;t define any
# remote_writes, it will use this list.
remote_write:
  - [&amp;lt;remote_write&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; For more information on remote_write, refer to the &lt;a href=&#34;https://prometheus.io/docs/prometheus/2.34/configuration/configuration/#remote_write&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus documentation&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;metrics_instance_config&#34;&gt;metrics_instance_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;metrics_instance_config&lt;/code&gt; block configures an individual metrics
instance, which acts as its own mini Prometheus-compatible agent, though
without support for the TSDB.&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;# Name of the instance. Must be present. Will be added as a label to agent
# metrics.
name: string

# Whether this agent instance should only scrape from targets running on the
# same machine as the agent process.
[host_filter: &amp;lt;boolean&amp;gt; | default = false]

# Relabel configs to apply against discovered targets. The relabeling is
# temporary and just used for filtering targets.
host_filter_relabel_configs:
  [ - &amp;lt;relabel_config&amp;gt; ... ]

# How frequently the WAL truncation process should run. Every iteration of
# the truncation will checkpoint old series and remove old samples. If data
# has not been sent within this window, some of it may be lost.
#
# The size of the WAL will increase with less frequent truncations. Making
# truncations more frequent reduces the size of the WAL but increases the
# chances of data loss when remote_write is failing for longer than the
# specified frequency.
[wal_truncate_frequency: &amp;lt;duration&amp;gt; | default = &amp;#34;60m&amp;#34;]

# The minimum amount of time that series and samples should exist in the WAL
# before being considered for deletion. The consumed disk space of the WAL will
# increase by making this value larger.
#
# Setting this value to 0s is valid, but may delete series before all
# remote_write shards have been able to write all data, and may cause errors on
# slower machines.
[min_wal_time: &amp;lt;duration&amp;gt; | default = &amp;#34;5m&amp;#34;]

# The maximum amount of time that series and samples may exist within the WAL
# before being considered for deletion. Series that have not received writes
# since this period will be removed, and all samples older than this period will
# be removed.
#
# This value is useful in long-running network outages, preventing the WAL from
# growing forever.
#
# Must be larger than min_wal_time.
[max_wal_time: &amp;lt;duration&amp;gt; | default = &amp;#34;4h&amp;#34;]

# Deadline for flushing data when a Prometheus instance shuts down
# before giving up and letting the shutdown proceed.
[remote_flush_deadline: &amp;lt;duration&amp;gt; | default = &amp;#34;1m&amp;#34;]

# When true, writes staleness markers to all active series to
# remote_write.
[write_stale_on_shutdown: &amp;lt;boolean&amp;gt; | default = false]

# A list of scrape configuration rules.
scrape_configs:
  - [&amp;lt;scrape_config&amp;gt;]

# A list of remote_write targets.
remote_write:
  - [&amp;lt;remote_write&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; More information on the following types can be found on the Prometheus
website:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://prometheus.io/docs/prometheus/2.34/configuration/configuration/#relabel_config&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;relabel_config&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://prometheus.io/docs/prometheus/2.34/configuration/configuration/#scrape_config&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;scrape_config&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://prometheus.io/docs/prometheus/2.34/configuration/configuration/#remote_write&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;remote_write&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;
]]></content><description>&lt;h1 id="metrics_config">metrics_config&lt;/h1>
&lt;p>The &lt;code>metrics_config&lt;/code> block is used to define a collection of metrics
instances. Each instance defines a collection of Prometheus-compatible
scrape_configs and remote_write rules. Most users will only need to
define one instance.&lt;/p></description></item><item><title>logs_config</title><link>https://grafana.com/docs/agent/v0.31/configuration/logs-config/</link><pubDate>Sat, 11 Apr 2026 09:32:03 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.31/configuration/logs-config/</guid><content><![CDATA[&lt;h1 id=&#34;logs_config&#34;&gt;logs_config&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;logs_config&lt;/code&gt; block configures how the Agent collects logs and sends them to
a Loki push API endpoint. &lt;code&gt;logs_config&lt;/code&gt; is identical to how Promtail is
configured, except deprecated fields have been removed and the server_config is
not supported.&lt;/p&gt;
&lt;p&gt;Refer to the
&lt;a href=&#34;/docs/loki/latest/clients/promtail/configuration/#clients&#34;&gt;Promtail documentation&lt;/a&gt;
for the supported values for these fields.&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;# Directory to store Loki Promtail positions files in. Positions files are
# required to read logs, and are used to store the last read offset of log
# sources. The positions files will be stored in
# &amp;lt;positions_directory&amp;gt;/&amp;lt;logs_instance_config.name&amp;gt;.yml.
#
# Optional only if every config has a positions.filename manually provided.
#
# This directory will be automatically created if it doesn&amp;#39;t exist.
[positions_directory: &amp;lt;string&amp;gt;]

# Configure values for all Loki Promtail instances.
[global: &amp;lt;global_config&amp;gt;]

# Loki Promtail instances to run for log collection.
configs:
  - [&amp;lt;logs_instance_config&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;global_config&#34;&gt;global_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;global_config&lt;/code&gt; block configures global values for all launched Loki Promtail
instances.&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;clients:
  - [&amp;lt;promtail.client_config&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; More information on the following types can be found on the
documentation for Promtail:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;/docs/loki/latest/clients/promtail/configuration/#clients&#34;&gt;&lt;code&gt;promtail.client_config&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;logs_instance_config&#34;&gt;logs_instance_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;logs_instance_config&lt;/code&gt; block is an individual instance of Promtail with its
own set of scrape rules and where to forward logs. It is identical to how
Promtail is configured, except deprecated fields have been removed and the
&lt;code&gt;server_config&lt;/code&gt; block is not supported.&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;# Name of this config. Required, and must be unique across all Loki configs.
# The name of the config will be the value of a logs_config label for all
# Loki Promtail metrics.
name: &amp;lt;string&amp;gt;

clients:
  - [&amp;lt;promtail.client_config&amp;gt;]

# Optional configuration for where to store the positions files. If
# positions.filename is left empty, the file will be stored in
# &amp;lt;logs_config.positions_directory&amp;gt;/&amp;lt;logs_instance_config.name&amp;gt;.yml.
#
# The directory of the positions file will automatically be created on start up
# if it doesn&amp;#39;t already exist..
[positions: &amp;lt;promtail.position_config&amp;gt;]

scrape_configs:
  - [&amp;lt;promtail.scrape_config&amp;gt;]

[target_config: &amp;lt;promtail.target_config&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; More information on the following types can be found on the
documentation for Promtail:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;/docs/loki/latest/clients/promtail/configuration/#clients&#34;&gt;&lt;code&gt;promtail.client_config&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/loki/latest/clients/promtail/configuration/#scrape_configs&#34;&gt;&lt;code&gt;promtail.scrape_config&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/loki/latest/clients/promtail/configuration/#target_config&#34;&gt;&lt;code&gt;promtail.target_config&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Backticks in values are not supported.&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;  Because of how YAML treats backslashes in double-quoted strings,
all backslashes in a regex expression must be escaped when using double
quotes. But because of double processing, in Grafana Agent config file
you must use quadruple backslash (&lt;code&gt;\\\\&lt;/code&gt;) construction to add backslashes
into regular expressions, here is example for &lt;code&gt;name=(\w&#43;)\s&lt;/code&gt; regex:&lt;/p&gt;&lt;/blockquote&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;  selector: &amp;#39;{app=&amp;#34;my-app&amp;#34;} |~ &amp;#34;name=(\\\\w&amp;#43;)\\\\s&amp;#34;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Using single or double backslash construction produces the error:&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;failed to make file target manager: invalid match stage config: invalid selector syntax for match stage: parse error at line 1, col 40: literal not terminated&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Using backticks produces the error:&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;invalid match stage config: invalid selector syntax for match stage: parse error at line 1, col 51: syntax error: unexpected IDENTIFIER, expecting STRING&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="logs_config">logs_config&lt;/h1>
&lt;p>The &lt;code>logs_config&lt;/code> block configures how the Agent collects logs and sends them to
a Loki push API endpoint. &lt;code>logs_config&lt;/code> is identical to how Promtail is
configured, except deprecated fields have been removed and the server_config is
not supported.&lt;/p></description></item><item><title>traces_config</title><link>https://grafana.com/docs/agent/v0.31/configuration/traces-config/</link><pubDate>Sat, 11 Apr 2026 09:32:03 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.31/configuration/traces-config/</guid><content><![CDATA[&lt;h1 id=&#34;traces_config&#34;&gt;traces_config&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;traces_config&lt;/code&gt; block configures a set of Tempo instances, each of which
configures its own tracing pipeline. Having multiple configs allows you to
configure multiple distinct pipelines, each of which collects spans and sends
them to a different location.&lt;/p&gt;
&lt;p&gt;Note that if using multiple configs, you must manually set port numbers for
each receiver, otherwise they will all try to use the same port and fail to
start.&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;configs:
 [ - &amp;lt;traces_instance_config&amp;gt; ... ]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;traces_instance_config&#34;&gt;traces_instance_config&lt;/h2&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;# Name configures the name of this Tempo instance. Names must be non-empty and
# unique across all Tempo instances. The value of the name here will appear in
# logs and as a label on metrics.
name: &amp;lt;string&amp;gt;

# This field allows for the general manipulation of tags on spans that pass
# through this agent. A common use may be to add an environment or cluster
# variable.
[ attributes: &amp;lt;attributes.config&amp;gt; ]

# This field allows to configure grouping spans into batches. Batching helps
# better compress the data and reduce the number of outgoing connections
# required transmit the data.
[ batch: &amp;lt;batch.config&amp;gt; ]

remote_write:
  # host:port to send traces to
  # Here must be the port of gRPC receiver, not the Tempo default port.
  # Example for cloud instances:  `tempo-us-central1.grafana.net:443`
  # For local / on-premises instances: `localhost:55680` or `tempo.example.com:14250`
  # Note: for non-encrypted connections you must also set `insecure: true`
  - endpoint: &amp;lt;string&amp;gt;

    # Custom HTTP headers to be sent along with each remote write request.
    # Be aware that &amp;#39;authorization&amp;#39; header will be overwritten in presence
    # of basic_auth.
    headers:
      [ &amp;lt;string&amp;gt;: &amp;lt;string&amp;gt; ... ]

    # Controls whether compression is enabled.
    [ compression: &amp;lt;string&amp;gt; | default = &amp;#34;gzip&amp;#34; | supported = &amp;#34;none&amp;#34;, &amp;#34;gzip&amp;#34;]

    # Controls what protocol to use when exporting traces.
    # Only &amp;#34;grpc&amp;#34; is supported in Grafana Cloud.
    [ protocol: &amp;lt;string&amp;gt; | default = &amp;#34;grpc&amp;#34; | supported = &amp;#34;grpc&amp;#34;, &amp;#34;http&amp;#34; ]

    # Controls what format to use when exporting traces, in combination with protocol.
    # protocol/format supported combinations are grpc/otlp, http/otlp and grpc/jaeger
    # Only grpc/otlp is supported in Grafana Cloud.
    [ format: &amp;lt;string&amp;gt; | default = &amp;#34;otlp&amp;#34; | supported = &amp;#34;otlp&amp;#34;, &amp;#34;jaeger&amp;#34; ]

    # Controls whether or not TLS is required.  See https://godoc.org/google.golang.org/grpc#WithInsecure
    [ insecure: &amp;lt;boolean&amp;gt; | default = false ]

    # Deprecated in favor of tls_config
    # If both `insecure_skip_verify` and `tls_config.insecure_skip_verify` are used,
    # the latter take precedence.
    [ insecure_skip_verify: &amp;lt;bool&amp;gt; | default = false ]

    # Configures opentelemetry exporters to use the OpenTelemetry auth extension `oauth2clientauthextension`.
    # Can not be used in combination with `basic_auth`.
    # See https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/oauth2clientauthextension/README.md
    oauth2:
      # Configures the TLS settings specific to the oauth2 client
      # The client identifier issued to the oauth client
      [ client_id: &amp;lt;string&amp;gt; ]
      # The secret string associated with the oauth client
      [ client_secret: &amp;lt;string&amp;gt; ]
      # The resource server&amp;#39;s token endpoint URL
      [ token_url: &amp;lt;string&amp;gt; ]
      # Optional, requested permissions associated with the oauth client
      [ scopes: [&amp;lt;string&amp;gt;] ]
      # Optional, specifies the timeout fetching tokens from the token_url. Default: no timeout
      [ timeout: &amp;lt;duration&amp;gt; ]
      tls:
        # Disable validation of the server certificate.
        [ insecure: &amp;lt;bool&amp;gt; | default = false ]
        # Path to the CA cert. For a client this verifies the server certificate. If empty uses system root CA.
        [ ca_file: &amp;lt;string&amp;gt; ]
        # Path to the TLS cert to use for TLS required connections
        [ cert_file: &amp;lt;string&amp;gt; ]
        # Path to the TLS key to use for TLS required connections
        [ key_file: &amp;lt;string&amp;gt; ]

    # Controls TLS settings of the exporter&amp;#39;s client. See https://github.com/open-telemetry/opentelemetry-collector/blob/v0.21.0/config/configtls/README.md
    # This should be used only if `insecure` is set to false
    tls_config:
      # Path to the CA cert. For a client this verifies the server certificate. If empty uses system root CA.
      [ ca_file: &amp;lt;string&amp;gt; ]
      # Path to the TLS cert to use for TLS required connections
      [ cert_file: &amp;lt;string&amp;gt; ]
      # Path to the TLS key to use for TLS required connections
      [ key_file: &amp;lt;string&amp;gt; ]
      # Disable validation of the server certificate.
      [ insecure_skip_verify: &amp;lt;bool&amp;gt; | default = false ]

    # Sets the `Authorization` header on every trace push with the
    # configured username and password.
    # password and password_file are mutually exclusive.
    basic_auth:
      [ username: &amp;lt;string&amp;gt; ]
      [ password: &amp;lt;secret&amp;gt; ]
      [ password_file: &amp;lt;string&amp;gt; ]

    [ sending_queue: &amp;lt;otlpexporter.sending_queue&amp;gt; ]
    [ retry_on_failure: &amp;lt;otlpexporter.retry_on_failure&amp;gt; ]

# This processor writes a well formatted log line to a logs instance for each span, root, or process
# that passes through the Agent. This allows for automatically building a mechanism for trace
# discovery and building metrics from traces using Loki. It should be considered experimental.
automatic_logging:
  # Indicates where the stream of log lines should go. Either supports writing
  # to a logs instance defined in this same config or to stdout.
  [ backend: &amp;lt;string&amp;gt; | default = &amp;#34;stdout&amp;#34; | supported &amp;#34;stdout&amp;#34;, &amp;#34;logs_instance&amp;#34; ]
  # Indicates the logs instance to write logs to.
  # Required if backend is set to logs_instance.
  [ logs_instance_name: &amp;lt;string&amp;gt; ]
  # Log one line per span. Warning! possibly very high volume
  [ spans: &amp;lt;boolean&amp;gt; ]
  # Log one line for every root span of a trace.
  [ roots: &amp;lt;boolean&amp;gt; ]
  # Log one line for every process
  [ processes: &amp;lt;boolean&amp;gt; ]
  # Additional span attributes to log
  [ span_attributes: &amp;lt;string array&amp;gt; ]
  # Additional process attributes to log
  [ process_attributes: &amp;lt;string array&amp;gt; ]
  # Timeout on writing logs to Loki when backend is &amp;#34;logs_instance.&amp;#34;
  [ timeout: &amp;lt;duration&amp;gt; | default = 1ms ]
  # Configures a set of key values that will be logged as labels
  # They need to be span or process attributes logged in the log line
  #
  # This feature only applies when `backend = logs_instance`
  #
  # Loki only accepts alphanumeric and &amp;#34;_&amp;#34; as valid characters for labels.
  # Labels are sanitized by replacing invalid characters with underscores.
  [ labels: &amp;lt;string array&amp;gt; ]
  overrides:
    [ logs_instance_tag: &amp;lt;string&amp;gt; | default = &amp;#34;traces&amp;#34; ]
    [ service_key: &amp;lt;string&amp;gt; | default = &amp;#34;svc&amp;#34; ]
    [ span_name_key: &amp;lt;string&amp;gt; | default = &amp;#34;span&amp;#34; ]
    [ status_key: &amp;lt;string&amp;gt; | default = &amp;#34;status&amp;#34; ]
    [ duration_key: &amp;lt;string&amp;gt; | default = &amp;#34;dur&amp;#34; ]
    [ trace_id_key: &amp;lt;string&amp;gt; | default = &amp;#34;tid&amp;#34; ]

# Receiver configurations are mapped directly into the OpenTelemetry receivers
# block. At least one receiver is required.
# The Agent uses OpenTelemetry v0.36.0. Refer to the corresponding receiver&amp;#39;s config.
#
# Supported receivers: otlp, jaeger, kafka, opencensus and zipkin.
receivers: &amp;lt;receivers&amp;gt;

# A list of prometheus scrape configs.  Targets discovered through these scrape
# configs have their __address__ matched against the ip on incoming spans. If a
# match is found then relabeling rules are applied.
scrape_configs:
  [ - &amp;lt;scrape_config&amp;gt; ... ]
# Defines what method is used when adding k/v to spans.
# Options are `update`, `insert` and `upsert`.
# `update` only modifies an existing k/v and `insert` only appends if the k/v
# is not present. `upsert` does both.
[ prom_sd_operation_type: &amp;lt;string&amp;gt; | default = &amp;#34;upsert&amp;#34; ]
# Configures what methods to use to do association between spans and pods.
# PromSD processor matches the IP address of the metadata labels from the k8s API
# with the IP address obtained from the specified pod association method.
# If a match is found then the span is labeled.
#
# Options are `ip`, `net.host.ip`, `k8s.pod.ip`, `hostname` and `connection`.
#   - `ip`, `net.host.ip` and `k8s.pod.ip`, `hostname` match spans tags.
#   - `connection` inspects the context from the incoming requests (gRPC and HTTP).
#
# Tracing instrumentation is commonly the responsible for tagging spans
# with IP address to the labels mentioned above.
# If running on kubernetes, `k8s.pod.ip` can be automatically attached via the
# downward API. For example, if you&amp;#39;re using OTel instrumentation libraries, set
# OTEL_RESOURCE_ATTRIBUTES=k8s.pod.ip=$(POD_IP) to inject spans with the sender
# pod&amp;#39;s IP.
#
# By default, all methods are enabled, and evaluated in the order specified above.
# Order of evaluation is honored when multiple methods are enabled.
prom_sd_pod_associations:
  [ - &amp;lt;string&amp;gt; ... ]

# spanmetrics supports aggregating Request, Error and Duration (R.E.D) metrics
# from span data.
#
# spanmetrics generates two metrics from spans and uses remote_write or
# OpenTelemetry Prometheus exporters to serve the metrics locally.
#
# In order to use the remote_write exporter, you have to configure a Prometheus
# instance in the Agent and pass its name to the `metrics_instance` field.
#
# If you want to use the OpenTelemetry Prometheus exporter, you have to
# configure handler_endpoint and then scrape that endpoint.
#
# The first generated metric is `calls`, a counter to compute requests.
# The second generated metric is `latency`, a histogram to compute the
# operation&amp;#39;s duration.
#
# If you want to rename the generated metrics, you can configure the `namespace`
# option of prometheus exporter.
#
# This is an experimental feature of Opentelemetry-Collector and the behavior
# may change in the future.
spanmetrics:
  # latency_histogram_buckets and dimensions are the same as the configs in
  # spanmetricsprocessor.
  [ latency_histogram_buckets: &amp;lt;spanmetricsprocessor.latency_histogram_buckets&amp;gt; ]
  [ dimensions: &amp;lt;spanmetricsprocessor.dimensions&amp;gt; ]
  # const_labels are labels that will always get applied to the exported
  # metrics.
  const_labels:
    [ &amp;lt;string&amp;gt;: &amp;lt;string&amp;gt; ... ]
  # Metrics are namespaced to `traces_spanmetrics` by default.
  # They can be further namespaced, i.e. `{namespace}_traces_spanmetrics`
  [ namespace: &amp;lt;string&amp;gt; ]
  # metrics_instance is the metrics instance used to remote write metrics.
  [ metrics_instance: &amp;lt;string&amp;gt; ]
  # handler_endpoint defines the endpoint where the OTel prometheus exporter will be exposed.
  [ handler_endpoint: &amp;lt;string&amp;gt; ]

# tail_sampling supports tail-based sampling of traces in the agent.
#
# Policies can be defined that determine what traces are sampled and sent to the
# backends and what traces are dropped.
#
# In order to make a correct sampling decision it&amp;#39;s important that the agent has
# a complete trace. This is achieved by waiting a given time for all the spans
# before evaluating the trace.
#
# Tail sampling also supports multi agent deployments, allowing to group all
# spans of a trace in the same agent by load balancing the spans by trace ID
# between the instances.
# * To make use of this feature, check load_balancing below *
tail_sampling:
  # policies define the rules by which traces will be sampled. Multiple policies
  # can be added to the same pipeline.
  policies:
    [ - &amp;lt;tailsamplingprocessor.policies&amp;gt; ... ]

  # Time that to wait before making a decision for a trace.
  # Longer wait times reduce the probability of sampling an incomplete trace at
  # the cost of higher memory usage.
  [ decision_wait: &amp;lt;duration&amp;gt; | default = 5s ]

  # Optional, number of traces kept in memory
  [ num_traces: &amp;lt;int&amp;gt; | default = 50000 ]

  # Optional, expected number of new traces (helps in allocating data structures)
  [ expected_new_traces_per_sec: &amp;lt;int&amp;gt; | default = 0 ]

# load_balancing configures load balancing of spans across multi agent deployments.
# It ensures that all spans of a trace are sampled in the same instance.
# It works by exporting spans based on their traceID via consistent hashing.
#
# Enabling this feature is required for tail_sampling to correctly work when
# different agent instances can receive spans for the same trace.
#
# Load balancing works by layering two pipelines and consistently exporting
# spans belonging to a trace to the same agent instance.
# Agent instances need to be able to communicate with each other via gRPC.
#
# Load balancing significantly increases CPU usage. This is because spans are
# exported an additional time between agents.
load_balancing:
  # resolver configures the resolution strategy for the involved backends
  # It can be static, with a fixed list of hostnames, or DNS, with a hostname
  # (and port) that will resolve to all IP addresses.
  resolver:
    static:
      hostnames:
        [ - &amp;lt;string&amp;gt; ... ]
    dns:
      hostname: &amp;lt;string&amp;gt;
      [ port: &amp;lt;int&amp;gt; ]

  # receiver_port is the port the instance will use to receive load balanced traces
  receiver_port: [ &amp;lt;int&amp;gt; | default = 4318 ]

  # Load balancing is done via an otlp exporter.
  # The remaining configuration is common with the remote_write block.
  exporter:
    # Controls whether compression is enabled.
    [ compression: &amp;lt;string&amp;gt; | default = &amp;#34;gzip&amp;#34; | supported = &amp;#34;none&amp;#34;, &amp;#34;gzip&amp;#34;]

    # Controls whether or not TLS is required.
    [ insecure: &amp;lt;boolean&amp;gt; | default = false ]

    # Disable validation of the server certificate. Only used when insecure is set
    # to false.
    [ insecure_skip_verify: &amp;lt;bool&amp;gt; | default = false ]

    # Sets the `Authorization` header on every trace push with the
    # configured username and password.
    # password and password_file are mutually exclusive.
    basic_auth:
      [ username: &amp;lt;string&amp;gt; ]
      [ password: &amp;lt;secret&amp;gt; ]
      [ password_file: &amp;lt;string&amp;gt; ]

# service_graphs configures processing of traces for building service graphs in
# the form of prometheus metrics. The generated metrics represent edges between
# nodes in the graph. Nodes are represented by `client` and `server` labels.
#
#  e.g. tempo_service_graph_request_total{client=&amp;#34;app&amp;#34;, server=&amp;#34;db&amp;#34;} 20
#
# Service graphs works by inspecting spans and looking for the tag `span.kind`.
# If it finds the span kind to be client or server, it stores the request in a
# local in-memory store.
#
# That request waits until its corresponding client or server pair span is
# processed or until the maximum waiting time has passed.
# When either of those conditions is reached, the request is processed and
# removed from the local store. If the request is complete by that time, it&amp;#39;ll
# be recorded as an edge in the graph.
#
# Service graphs supports multi-agent deployments, allowing to group all spans
# of a trace in the same agent by load balancing the spans by trace ID between
# the instances.
# * To make use of this feature, check load_balancing above *
service_graphs:
  [ enabled: &amp;lt;bool&amp;gt; | default = false ]

  # configures the time the processor will wait since a span is consumed until
  # it&amp;#39;s considered expired if its paired has not been processed.
  #
  # increasing the waiting time will increase the percentage of paired spans.
  # retaining unpaired spans for longer will make reaching max_items more likely.
  [ wait: &amp;lt;duration&amp;gt; | default = 10s ]

  # configures the max amount of edges that will be stored in memory.
  #
  # spans that arrive to the processor that do not pair with an already
  # processed span are dropped.
  #
  # a higher max number of items increases the max throughput of processed spans
  # with a higher memory consumption.
  [ max_items: &amp;lt;integer&amp;gt; | default = 10_000 ]

  # configures the number of workers that will process completed edges concurrently.
  # as edges are completed, they get queued to be collected as metrics for the graph.
  [ workers: &amp;lt;integer&amp;gt; | default = 10 ]

  # configures what status codes are considered as successful (e.g. HTTP 404).
  #
  # by default, a request is considered failed in the following cases:
  #   1. HTTP status is not 2XX
  #   1. gRPC status code is not OK
  #   1. span status is Error
  success_codes:
    # http status codes not to be considered as failure
    http:
      [ - &amp;lt;int&amp;gt; ... ]
    # grpc status codes not to be considered as failure
    grpc:
      [ - &amp;lt;int&amp;gt; ... ]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; More information on the following types can be found on the
documentation for their respective projects:&lt;/p&gt;&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/b2327211df976e0a57ef0425493448988772a16b/processor/attributesprocessor&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;attributes.config&lt;/code&gt;: OpenTelemetry-Collector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector/tree/1f5dd9f9a566a937ec15093ca3bc377fba86f5f9/processor/batchprocessor&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;batch.config&lt;/code&gt;: OpenTelemetry-Collector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector/tree/1f5dd9f9a566a937ec15093ca3bc377fba86f5f9/exporter/otlpexporter&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;otlpexporter.sending_queue&lt;/code&gt;: OpenTelemetry-Collector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector/tree/1f5dd9f9a566a937ec15093ca3bc377fba86f5f9/exporter/otlpexporter&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;otlpexporter.retry_on_failure&lt;/code&gt;: OpenTelemetry-Collector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;receivers&lt;/code&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/b2327211df976e0a57ef0425493448988772a16b/receiver/jaegerreceiver&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;jaegerreceiver&lt;/code&gt;: OpenTelemetry-Collector-Contrib&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/b2327211df976e0a57ef0425493448988772a16b/receiver/kafkareceiver&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;kafkareceiver&lt;/code&gt;: OpenTelemetry-Collector-Contrib&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector/tree/1f5dd9f9a566a937ec15093ca3bc377fba86f5f9/receiver/otlpreceiver&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;otlpreceiver&lt;/code&gt;: OpenTelemetry-Collector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/b2327211df976e0a57ef0425493448988772a16b/receiver/opencensusreceiver&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;opencensusreceiver&lt;/code&gt;: OpenTelemetry-Collector-Contrib&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/b2327211df976e0a57ef0425493448988772a16b/receiver/zipkinreceiver&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;zipkinreceiver&lt;/code&gt;: OpenTelemetry-Collector-Contrib&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://prometheus.io/docs/prometheus/2.34/configuration/configuration/#scrape_config&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;scrape_config&lt;/code&gt;: Prometheus&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/b2327211df976e0a57ef0425493448988772a16b/processor/spanmetricsprocessor/config.go#L38-L47&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;spanmetricsprocessor.latency_histogram_buckets&lt;/code&gt;: OpenTelemetry-Collector-Contrib&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/b2327211df976e0a57ef0425493448988772a16b/processor/spanmetricsprocessor/config.go#L38-L47&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;spanmetricsprocessor.dimensions&lt;/code&gt;: OpenTelemetry-Collector-Contrib&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/b2327211df976e0a57ef0425493448988772a16b/processor/tailsamplingprocessor&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;tailsamplingprocessor.policies&lt;/code&gt;: OpenTelemetry-Collector-Contrib&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="traces_config">traces_config&lt;/h1>
&lt;p>The &lt;code>traces_config&lt;/code> block configures a set of Tempo instances, each of which
configures its own tracing pipeline. Having multiple configs allows you to
configure multiple distinct pipelines, each of which collects spans and sends
them to a different location.&lt;/p></description></item><item><title>dynamic_config</title><link>https://grafana.com/docs/agent/v0.31/configuration/dynamic-config/</link><pubDate>Sat, 11 Apr 2026 09:32:03 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.31/configuration/dynamic-config/</guid><content><![CDATA[&lt;h1 id=&#34;dynamic-configuration---experimental&#34;&gt;Dynamic Configuration - Experimental&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;This is experimental and subject to change at anytime, feedback is much appreciated. This is a feature that MAY NOT make it production.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Dynamic Configuration is the combination of two things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Loading from multiple files&lt;/li&gt;
&lt;li&gt;Using templates and datasources&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Both of these make heavy use of the excellent &lt;a href=&#34;https://github.com/hairyhenderson/gomplate&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;gomplate&lt;/a&gt;. The goal is
that as the configuration grows that it can be split it up into smaller segments to allow better readability and handling.
The configurations cannot be patched in any order and instead are allowed at several levels.&lt;/p&gt;
&lt;p&gt;The second goal is to allow the use of templating, functions for &lt;a href=&#34;https://docs.gomplate.ca/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;gomplate doc&lt;/a&gt; go into detail
on what functions are available.&lt;/p&gt;
&lt;h2 id=&#34;configuration&#34;&gt;Configuration&lt;/h2&gt;
&lt;p&gt;Dynamic configuration files can be used by passing &lt;code&gt;-config.file.type=dynamic -enable-features=dynamic-config,integrations-next&lt;/code&gt;. When these flags are
passed, the file referred to &lt;code&gt;-config.file&lt;/code&gt; will be loaded as a dynamic
configuration file.&lt;/p&gt;
&lt;p&gt;Dynamic configuration files are YAML which conform the following schema:&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;# Sources to pull template values
datasources:
  [- &amp;lt;sources_config&amp;gt;]

# Locations to use searching for templates, the system does NOT look into subdirectories. Follows gomplate schema
# from [gomplate datasources](https://docs.gomplate.ca/datasources/). File and S3/GCP templates are currently supported
template_paths:
  [ - string ]

# Filters allow you to override the default naming convention

agent_filter:            string # defaults to agent-*.yml
server_filter:           string # defaults to server-*.yml
metrics_filter:          string # defaults to metrics-*.yml
metrics_instance_filter: string # defaults to metrics_instances-*.yml
integrations_filter:     string # defaults to integrations-*.yml
logs_filter:             string # defaults to logs-*.yml
traces_filter:           string # defaults to traces-*.yml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;sources_config&#34;&gt;sources_config&lt;/h3&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;# Name of the source to use when templating
name: string

# Path to datasource using schema from [gomplate datasources](https://docs.gomplate.ca/datasources/)
url: string&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;templates&#34;&gt;Templates&lt;/h2&gt;
&lt;p&gt;Note when adding a template you MUST NOT add the type as the top level yaml field. For instance if using traces:&lt;/p&gt;
&lt;p&gt;Incorrect&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;traces:
  configs:
  - name: default
    automatic_logging:
      backend: loki
      loki_name: default
      spans: true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Correct&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;configs:
- name: default
  automatic_logging:
    backend: loki
    loki_name: default
    spans: true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Configurations are loaded in the order as they are listed below.&lt;/p&gt;
&lt;h3 id=&#34;agent&#34;&gt;Agent&lt;/h3&gt;
&lt;p&gt;Agent template is the standard agent configuration file in its entirety. The default filter is &lt;code&gt;agent-*.yml&lt;/code&gt;. Only
one file is supported. This is processed first then any subsequent configurations found REPLACE the values here, it is
not additive.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;./&#34;&gt;Reference&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;server&#34;&gt;Server&lt;/h3&gt;
&lt;p&gt;The default filter is &lt;code&gt;server-*.yml&lt;/code&gt;, only ONE server file is supported.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;../server-config/&#34;&gt;Reference&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;metrics&#34;&gt;Metrics&lt;/h3&gt;
&lt;p&gt;The default filter is &lt;code&gt;metrics-*.yml&lt;/code&gt;, only ONE metrics file is supported.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;../metrics-config/&#34;&gt;Reference&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;metric-instances&#34;&gt;Metric Instances&lt;/h3&gt;
&lt;p&gt;The default filter is &lt;code&gt;metrics_instances-*.yml&lt;/code&gt;. Any metric instances are appended to the instances defined in Metrics above. Any number of metric instance files are supporter.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;../metrics-config/#metrics_instance_config&#34;&gt;Reference&lt;/a&gt; in the metrics instance&lt;/p&gt;
&lt;h3 id=&#34;integrations&#34;&gt;Integrations&lt;/h3&gt;
&lt;p&gt;The default filter is &lt;code&gt;integrations-*.yml&lt;/code&gt;, these support more than one file, and multiple integrations can be defined in a file. Do not assume any order of loading for integrations. For any integration that is a singleton, loading multiple of those will result in an error.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;../integrations/&#34;&gt;Reference&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;traces&#34;&gt;Traces&lt;/h3&gt;
&lt;p&gt;The default filter is &lt;code&gt;traces-*.yml&lt;/code&gt;. This supports ONE file.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;../traces-config/&#34;&gt;Reference&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;logs&#34;&gt;Logs&lt;/h3&gt;
&lt;p&gt;The default filter is &lt;code&gt;logs-*.yml&lt;/code&gt;. This supports ONE file.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;../logs-config/&#34;&gt;Reference&lt;/a&gt;&lt;/p&gt;
]]></content><description>&lt;h1 id="dynamic-configuration---experimental">Dynamic Configuration - Experimental&lt;/h1>
&lt;p>&lt;strong>This is experimental and subject to change at anytime, feedback is much appreciated. This is a feature that MAY NOT make it production.&lt;/strong>&lt;/p></description></item><item><title>integrations_config</title><link>https://grafana.com/docs/agent/v0.31/configuration/integrations/</link><pubDate>Sat, 11 Apr 2026 09:32:03 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.31/configuration/integrations/</guid><content><![CDATA[&lt;h1 id=&#34;integrations_config&#34;&gt;integrations_config&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;integrations_config&lt;/code&gt; block configures how the Agent runs integrations that
scrape and send metrics without needing to run specific Prometheus exporters or
manually write &lt;code&gt;scrape_configs&lt;/code&gt;:&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;# Controls the Agent integration
agent:
  # Enables the Agent integration, allowing the Agent to automatically
  # collect and send metrics about itself.
  [enabled: &amp;lt;boolean&amp;gt; | default = false]

  # Sets an explicit value for the instance label when the integration is
  # self-scraped. Overrides inferred values.
  #
  # The default value for this integration is inferred from the agent hostname
  # and HTTP listen port, delimited by a colon.
  [instance: &amp;lt;string&amp;gt;]

  # Automatically collect metrics from this integration. If disabled,
  # the agent integration will be run but not scraped and thus not
  # remote_written. Metrics for the integration will be exposed at
  # /integrations/agent/metrics and can be scraped by an external process.
  [scrape_integration: &amp;lt;boolean&amp;gt; | default = &amp;lt;integrations_config.scrape_integrations&amp;gt;]

  # How often should the metrics be collected? Defaults to
  # prometheus.global.scrape_interval.
  [scrape_interval: &amp;lt;duration&amp;gt; | default = &amp;lt;global_config.scrape_interval&amp;gt;]

  # The timeout before considering the scrape a failure. Defaults to
  # prometheus.global.scrape_timeout.
  [scrape_timeout: &amp;lt;duration&amp;gt; | default = &amp;lt;global_config.scrape_timeout&amp;gt;]

  # How frequent to truncate the WAL for this integration.
  [wal_truncate_frequency: &amp;lt;duration&amp;gt; | default = &amp;#34;60m&amp;#34;]

  # Allows for relabeling labels on the target.
  relabel_configs:
    [- &amp;lt;relabel_config&amp;gt; ... ]

  # Relabel metrics coming from the integration, allowing to drop series
  # from the integration that you don&amp;#39;t care about.
  metric_relabel_configs:
    [ - &amp;lt;relabel_config&amp;gt; ... ]

# Client TLS Configuration
# Client Cert/Key Values need to be defined if the server is requesting a certificate
#  (Client Auth Type = RequireAndVerifyClientCert || RequireAnyClientCert).
http_tls_config: &amp;lt;tls_config&amp;gt;

# Controls the apache_http integration
apache_http: &amp;lt;apache_http_config&amp;gt;

# Controls the node_exporter integration
node_exporter: &amp;lt;node_exporter_config&amp;gt;

# Controls the process_exporter integration
process_exporter: &amp;lt;process_exporter_config&amp;gt;

# Controls the mysqld_exporter integration
mysqld_exporter: &amp;lt;mysqld_exporter_config&amp;gt;

# Controls the redis_exporter integration
redis_exporter: &amp;lt;redis_exporter_config&amp;gt;

# Controls the dnsmasq_exporter integration
dnsmasq_exporter: &amp;lt;dnsmasq_exporter_config&amp;gt;

# Controls the elasticsearch_exporter integration
elasticsearch_exporter: &amp;lt;elasticsearch_exporter_config&amp;gt;

# Controls the memcached_exporter integration
memcached_exporter: &amp;lt;memcached_exporter_config&amp;gt;

# Controls the postgres_exporter integration
postgres_exporter: &amp;lt;postgres_exporter_config&amp;gt;

# Controls the snmp_exporter integration
snmp_exporter: &amp;lt;snmp_exporter_config&amp;gt;

# Controls the snowflake integration
snowflake: &amp;lt;snowflake_config&amp;gt;

# Controls the statsd_exporter integration
statsd_exporter: &amp;lt;statsd_exporter_config&amp;gt;

# Controls the consul_exporter integration
consul_exporter: &amp;lt;consul_exporter_config&amp;gt;

# Controls the windows_exporter integration
windows_exporter: &amp;lt;windows_exporter_config&amp;gt;

# Controls the kafka_exporter integration
kafka_exporter: &amp;lt;kafka_exporter_config&amp;gt;

# Controls the mongodb_exporter integration
mongodb_exporter: &amp;lt;mongodb_exporter_config&amp;gt;

# Controls the github_exporter integration
github_exporter: &amp;lt;github_exporter_config&amp;gt;

# Controls the blackbox_exporter integration
blackbox: &amp;lt;blackbox_config&amp;gt;

# Automatically collect metrics from enabled integrations. If disabled,
# integrations will be run but not scraped and thus not remote_written. Metrics
# for integrations will be exposed at /integrations/&amp;lt;integration_key&amp;gt;/metrics
# and can be scraped by an external process.
[scrape_integrations: &amp;lt;boolean&amp;gt; | default = true]

# Extra labels to add to all samples coming from integrations.
labels:
  { &amp;lt;string&amp;gt;: &amp;lt;string&amp;gt; }

# The period to wait before restarting an integration that exits with an
# error.
[integration_restart_backoff: &amp;lt;duration&amp;gt; | default = &amp;#34;5s&amp;#34;]

# A list of remote_write targets. Defaults to global_config.remote_write.
# If provided, overrides the global defaults.
prometheus_remote_write:
  - [&amp;lt;remote_write&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="integrations_config">integrations_config&lt;/h1>
&lt;p>The &lt;code>integrations_config&lt;/code> block configures how the Agent runs integrations that
scrape and send metrics without needing to run specific Prometheus exporters or
manually write &lt;code>scrape_configs&lt;/code>:&lt;/p></description></item><item><title>Scraping Service Mode</title><link>https://grafana.com/docs/agent/v0.31/configuration/scraping-service/</link><pubDate>Sat, 11 Apr 2026 09:32:03 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.31/configuration/scraping-service/</guid><content><![CDATA[&lt;h1 id=&#34;scraping-service-mode-beta&#34;&gt;Scraping Service Mode (Beta)&lt;/h1&gt;
&lt;p&gt;Scraping Service Mode is a third operational mode of the Grafana Agent
that allows for clustering a set of Agent processes and distributing scrape load
across them.&lt;/p&gt;
&lt;p&gt;Determining what to scrape is done by writing instance configuration files to an
&lt;a href=&#34;../../api/&#34;&gt;API&lt;/a&gt;, which then stores the configuration files in a KV store backend.
All agents in the cluster &lt;strong&gt;must&lt;/strong&gt; use the same KV store so they see the same set
of config files.&lt;/p&gt;
&lt;p&gt;Each process of the Grafana Agent can be running multiple independent
&amp;ldquo;instances&amp;rdquo; at once, where an &amp;ldquo;instance&amp;rdquo; refers to the combination of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Service discovery for all &lt;code&gt;scrape_configs&lt;/code&gt; within that loaded config&lt;/li&gt;
&lt;li&gt;Scrapes metrics from all discovered targets&lt;/li&gt;
&lt;li&gt;Stores data in its own Write-Ahead Log specific to the loaded config&lt;/li&gt;
&lt;li&gt;Remote Writes scraped metrics to the configured &lt;code&gt;remote_write&lt;/code&gt; destinations
specified within the loaded config.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &amp;ldquo;instance configuration file,&amp;rdquo; then, is the configuration file that
specifies the set of &lt;code&gt;scrape_configs&lt;/code&gt; and &lt;code&gt;remote_write&lt;/code&gt; endpoints. For example,
a small instance configuration file looks like:&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;scrape_configs:
  - job_name: self-scrape
    static_configs:
      - targets: [&amp;#39;localhost:9090&amp;#39;]
        labels:
          process: &amp;#39;agent&amp;#39;
remote_write:
  - url: http://cortex:9009/api/prom/push&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The full set of supported options for an instance configuration file is
available in the
&lt;a href=&#34;../metrics-config/&#34;&gt;&lt;code&gt;metrics-config.md&lt;/code&gt; file&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Having multiple instance configuration files is necessary for sharding; each
config file is distributed to a particular agent on the cluster based on the
hash of its contents.&lt;/p&gt;
&lt;p&gt;When Scraping Service Mode is enabled, Agents &lt;strong&gt;disallow&lt;/strong&gt; specifying
instance configurations locally in the configuration file; using the KV store
is required. &lt;a href=&#34;#agentctl&#34;&gt;&lt;code&gt;agentctl&lt;/code&gt;&lt;/a&gt; can be used to manually sync
instance configuration files to the Agent&amp;rsquo;s API server.&lt;/p&gt;
&lt;h2 id=&#34;distributed-hash-ring&#34;&gt;Distributed hash ring&lt;/h2&gt;
&lt;p&gt;Scraping Service Mode uses a Distributed Hash Ring (commonly just called &amp;ldquo;the
ring&amp;rdquo;) to cluster agents and to shard configurations within that ring. Each
Agent joins the ring with a random distinct set of &lt;em&gt;tokens&lt;/em&gt; that are used for
sharding. The default number of generated tokens is 128.&lt;/p&gt;
&lt;p&gt;The Distributed Hash Ring is also stored in a KV store. Since a KV store is
also needed for storing configuration files, it is encouraged to re-use
the same KV store for the ring.&lt;/p&gt;
&lt;p&gt;When sharding, the Agent currently uses the name of a config file
stored in the KV store for load distribution. Config names are guaranteed to be
unique keys. The hash of the name is used as the &lt;em&gt;lookup key&lt;/em&gt; in the ring and
determines which agent (based on token) should be responsible for that config.
&amp;ldquo;Price is Right&amp;rdquo; rules are used for the Agent lookup; the Agent owning the token
with the closest value to the key without going over is responsible for the
config.&lt;/p&gt;
&lt;p&gt;All Agents are simultaneously watching the KV store for changes to the set of
configuration files. When a config file is added or updated in the configuration
store, each Agent will run the config name hash through their copy of the Hash
Ring to determine if they are responsible for that config.&lt;/p&gt;
&lt;p&gt;When an Agent receives a new config that it is responsible for, it launches a
new instance from the instance config. If a config is deleted from the KV store,
this will be detected by the owning Agent and it will stop the metric collection
process for that config file.&lt;/p&gt;
&lt;p&gt;When an Agent receives an event for an updated configuration file that they used to
be the owner of but are no longer the owner, the associated instance for that
configuration file is stopped for that Agent. This can happen when the cluster
size changes.&lt;/p&gt;
&lt;p&gt;Scraping Service Mode currently does not support replication; only one agent
at a time will be responsible for scraping a certain config.&lt;/p&gt;
&lt;h3 id=&#34;resharding&#34;&gt;Resharding&lt;/h3&gt;
&lt;p&gt;When a new Agent joins or leaves the cluster, the set of tokens in the ring may
cause configurations to hash to a new Agent. The process of responding to this
action is called &amp;ldquo;resharding.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;Resharding is run:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;When an Agent joins the ring&lt;/li&gt;
&lt;li&gt;When an Agent leaves the ring&lt;/li&gt;
&lt;li&gt;When the KV store sends a notification indicating a config has changed.&lt;/li&gt;
&lt;li&gt;On a specified interval in case KV change events have not fired.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The resharding process involves each Agent retrieving the full set of
configurations stored in the KV store and determining if:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The config owned by the current resharding Agent has changed and needs to
be reloaded.&lt;/li&gt;
&lt;li&gt;The config is no longer owned by the current resharding Agent and the
associated instance should be stopped.&lt;/li&gt;
&lt;li&gt;The config has been deleted and the associated instance should be stopped.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;best-practices&#34;&gt;Best practices&lt;/h2&gt;
&lt;p&gt;Because distribution is determined by the number of config files and not how
many targets exist per config file, the best amount of distribution is achieved
when each config file has the lowest amount of targets possible. The best
distribution will be achieved if each config file stored in the KV store is
limited to one static config with only one target.&lt;/p&gt;
&lt;p&gt;A better distribution mechanism that distributes based on discovered targets is
planned for the future.&lt;/p&gt;
&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;
&lt;p&gt;Here&amp;rsquo;s an example &lt;code&gt;agent.yaml&lt;/code&gt; config file that uses the same &lt;code&gt;etcd&lt;/code&gt; server for
both configuration storage and the distributed hash ring storage:&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;server:
  log_level: debug

metrics:
  global:
    scrape_interval: 1m
  scraping_service:
    enabled: true
    kvstore:
      store: etcd
      etcd:
        endpoints:
          - etcd:2379
    lifecycler:
      ring:
        replication_factor: 1
        kvstore:
          store: etcd
          etcd:
            endpoints:
              - etcd:2379&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note that there are no instance configs present in this example; instance
configs must be passed to the API for the Agent to start scraping metrics.&lt;/p&gt;
&lt;h2 id=&#34;agentctl&#34;&gt;agentctl&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;agentctl&lt;/code&gt; is a tool included with this repository that helps users interact
with the new Config Management API. The &lt;code&gt;agentctl config-sync&lt;/code&gt; subcommand uses
local YAML files as a source of truth and syncs their contents with the API.
Entries in the API not in the synced directory will be deleted.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;agentctl&lt;/code&gt; is distributed in binary form with each release and as a Docker
container with the &lt;code&gt;grafana/agentctl&lt;/code&gt; image. Tanka configurations that
utilize &lt;code&gt;grafana/agentctl&lt;/code&gt; and sync a set of configurations to the API
are planned for the future.&lt;/p&gt;
]]></content><description>&lt;h1 id="scraping-service-mode-beta">Scraping Service Mode (Beta)&lt;/h1>
&lt;p>Scraping Service Mode is a third operational mode of the Grafana Agent
that allows for clustering a set of Agent processes and distributing scrape load
across them.&lt;/p></description></item></channel></rss>