<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Grafana Loki on Grafana Labs</title><link>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/</link><description>Recent content in Grafana Loki on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/enterprise-logs/v1.9.x/loki/index.xml" rel="self" type="application/rss+xml"/><item><title>LogCLI</title><link>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/logcli/</link><pubDate>Tue, 16 Jul 2024 15:42:20 +0000</pubDate><guid>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/logcli/</guid><content><![CDATA[&lt;h1 id=&#34;logcli-grafana-lokis-command-line-interface&#34;&gt;LogCLI, Grafana Loki&amp;rsquo;s command-line interface&lt;/h1&gt;
&lt;p&gt;LogCLI is the command-line interface to Grafana Loki.
It facilitates running LogQL
queries against a Loki instance.&lt;/p&gt;
&lt;h2 id=&#34;installation&#34;&gt;Installation&lt;/h2&gt;
&lt;h3 id=&#34;binary-recommended&#34;&gt;Binary (Recommended)&lt;/h3&gt;
&lt;p&gt;Download the &lt;code&gt;logcli&lt;/code&gt; binary from the
&lt;a href=&#34;https://github.com/grafana/loki/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Loki releases page&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;build-logcli-from-source&#34;&gt;Build LogCLI from source&lt;/h3&gt;
&lt;p&gt;Clone the Loki repository and build &lt;code&gt;logcli&lt;/code&gt; from source:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;git clone https://github.com/grafana/loki.git
cd loki
make logcli&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Optionally, move the binary into a directory that is part of your &lt;code&gt;$PATH&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;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;cp cmd/logcli/logcli /usr/local/bin/logcli&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;logcli-usage&#34;&gt;LogCLI usage&lt;/h2&gt;
&lt;h3 id=&#34;grafana-cloud-example&#34;&gt;Grafana Cloud example&lt;/h3&gt;
&lt;p&gt;If you are running on Grafana Cloud, use:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;export LOKI_ADDR=https://logs-us-west1.grafana.net
export LOKI_USERNAME=&amp;lt;username&amp;gt;
export LOKI_PASSWORD=&amp;lt;password&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Otherwise you can point LogCLI to a local instance directly
without needing a username and password:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;export LOKI_ADDR=http://localhost:3100&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: If you are running Loki behind a proxy server and you have
authentication configured, you will also have to pass in LOKI_USERNAME
and LOKI_PASSWORD, LOKI_BEARER_TOKEN or LOKI_BEARER_TOKEN_FILE accordingly.&lt;/p&gt;&lt;/blockquote&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ logcli labels job
https://logs-dev-ops-tools1.grafana.net/api/prom/label/job/values
loki-ops/consul
loki-ops/loki-gw
...

$ logcli query &amp;#39;{job=&amp;#34;loki-ops/consul&amp;#34;}&amp;#39;
https://logs-dev-ops-tools1.grafana.net/api/prom/query?query=%7Bjob%3D%22loki-ops%2Fconsul%22%7D&amp;amp;limit=30&amp;amp;start=1529928228&amp;amp;end=1529931828&amp;amp;direction=backward&amp;amp;regexp=
Common labels: {job=&amp;#34;loki-ops/consul&amp;#34;, namespace=&amp;#34;loki-ops&amp;#34;}
2018-06-25T12:52:09Z {instance=&amp;#34;consul-8576459955-pl75w&amp;#34;} 2018/06/25 12:52:09 [INFO] raft: Snapshot to 475409 complete
2018-06-25T12:52:09Z {instance=&amp;#34;consul-8576459955-pl75w&amp;#34;} 2018/06/25 12:52:09 [INFO] raft: Compacting logs from 456973 to 465169
...

$ logcli series -q --match=&amp;#39;{namespace=&amp;#34;loki&amp;#34;,container_name=&amp;#34;loki&amp;#34;}&amp;#39;
{app=&amp;#34;loki&amp;#34;, container_name=&amp;#34;loki&amp;#34;, controller_revision_hash=&amp;#34;loki-57c9df47f4&amp;#34;, filename=&amp;#34;/var/log/pods/loki_loki-0_8ed03ded-bacb-4b13-a6fe-53a445a15887/loki/0.log&amp;#34;, instance=&amp;#34;loki-0&amp;#34;, job=&amp;#34;loki/loki&amp;#34;, name=&amp;#34;loki&amp;#34;, namespace=&amp;#34;loki&amp;#34;, release=&amp;#34;loki&amp;#34;, statefulset_kubernetes_io_pod_name=&amp;#34;loki-0&amp;#34;, stream=&amp;#34;stderr&amp;#34;}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;batched-queries&#34;&gt;Batched queries&lt;/h3&gt;
&lt;p&gt;LogCLI sends queries to Loki such that query results arrive in batches.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;--limit&lt;/code&gt; option for a &lt;code&gt;logcli query&lt;/code&gt; command caps the quantity of
log lines for a single query.
When not set, &lt;code&gt;--limit&lt;/code&gt; defaults to 30.
The limit protects the user from overwhelming the system
for cases in which the specified query would have returned a large quantity
of log lines.
The limit also protects the user from unexpectedly large responses.&lt;/p&gt;
&lt;p&gt;The quantity of log line results that arrive in each batch
is set by the &lt;code&gt;--batch&lt;/code&gt; option in a &lt;code&gt;logcli query&lt;/code&gt; command.
When not set, &lt;code&gt;--batch&lt;/code&gt; defaults to 1000.&lt;/p&gt;
&lt;p&gt;Setting a &lt;code&gt;--limit&lt;/code&gt; value larger than the &lt;code&gt;--batch&lt;/code&gt; value causes the
requests from LogCLI to Loki to be batched.
Loki has a server-side limit that defaults to 5000 for the maximum quantity
of lines returned for a single query.
The batching of requests allows you to query for a results set that
is larger than the server-side limit,
as long as the &lt;code&gt;--batch&lt;/code&gt; value is less than the server limit.&lt;/p&gt;
&lt;p&gt;Query metadata is output to &lt;code&gt;stderr&lt;/code&gt; for each batch.
Set the &lt;code&gt;--quiet&lt;/code&gt; option on the &lt;code&gt;logcli query&lt;/code&gt; command line to suppress
the output of the query metadata.&lt;/p&gt;
&lt;h3 id=&#34;configuration&#34;&gt;Configuration&lt;/h3&gt;
&lt;p&gt;Configuration values are considered in the following order (lowest to highest):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Environment variables&lt;/li&gt;
&lt;li&gt;Command-line options&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;logcli-command-reference&#34;&gt;LogCLI command reference&lt;/h3&gt;
&lt;p&gt;The output of &lt;code&gt;logcli help&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;nohighlight&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-nohighlight&#34;&gt;usage: logcli [&amp;lt;flags&amp;gt;] &amp;lt;command&amp;gt; [&amp;lt;args&amp;gt; ...]

A command-line for loki.

Flags:
      --help             Show context-sensitive help (also try --help-long and
                         --help-man).
      --version          Show application version.
  -q, --quiet            Suppress query metadata
      --stats            Show query statistics
  -o, --output=default   Specify output mode [default, raw, jsonl]. raw
                         suppresses log labels and timestamp.
  -z, --timezone=Local   Specify the timezone to use when formatting output
                         timestamps [Local, UTC]
      --cpuprofile=&amp;#34;&amp;#34;    Specify the location for writing a CPU profile.
      --memprofile=&amp;#34;&amp;#34;    Specify the location for writing a memory profile.
      --stdin            Take input logs from stdin
      --addr=&amp;#34;http://localhost:3100&amp;#34;
                         Server address. Can also be set using LOKI_ADDR env
                         var.
      --username=&amp;#34;&amp;#34;      Username for HTTP basic auth. Can also be set using
                         LOKI_USERNAME env var.
      --password=&amp;#34;&amp;#34;      Password for HTTP basic auth. Can also be set using
                         LOKI_PASSWORD env var.
      --ca-cert=&amp;#34;&amp;#34;       Path to the server Certificate Authority. Can also be
                         set using LOKI_CA_CERT_PATH env var.
      --tls-skip-verify  Server certificate TLS skip verify.
      --cert=&amp;#34;&amp;#34;          Path to the client certificate. Can also be set using
                         LOKI_CLIENT_CERT_PATH env var.
      --key=&amp;#34;&amp;#34;           Path to the client certificate key. Can also be set
                         using LOKI_CLIENT_KEY_PATH env var.
      --org-id=&amp;#34;&amp;#34;        adds X-Scope-OrgID to API requests for representing
                         tenant ID. Useful for requesting tenant data when
                         bypassing an auth gateway.

Commands:
  help [&amp;lt;command&amp;gt;...]
    Show help.

  query [&amp;lt;flags&amp;gt;] &amp;lt;query&amp;gt;
    Run a LogQL query.

    The &amp;#34;query&amp;#34; command is useful for querying for logs. Logs can be returned in
    a few output modes:

      raw: log line
      default: log timestamp &amp;#43; log labels &amp;#43; log line
      jsonl: JSON response from Loki API of log line

    The output of the log can be specified with the &amp;#34;-o&amp;#34; flag, for example, &amp;#34;-o
    raw&amp;#34; for the raw output format.

    The &amp;#34;query&amp;#34; command will output extra information about the query and its
    results, such as the API URL, set of common labels, and set of excluded
    labels. This extra information can be suppressed with the --quiet flag.

    By default we look over the last hour of data; use --since to modify or
    provide specific start and end times with --from and --to respectively.

    Notice that when using --from and --to then ensure to use RFC3339Nano time
    format, but without timezone at the end. The local timezone will be added
    automatically or if using --timezone flag.

    Example:

      logcli query
         --timezone=UTC
         --from=&amp;#34;2021-01-19T10:00:00Z&amp;#34;
         --to=&amp;#34;2021-01-19T20:00:00Z&amp;#34;
         --output=jsonl
         &amp;#39;my-query&amp;#39;

    The output is limited to 30 entries by default; use --limit to increase.

    While &amp;#34;query&amp;#34; does support metrics queries, its output contains multiple
    data points between the start and end query time. This output is used to
    build graphs, similar to what is seen in the Grafana Explore graph view. If
    you are querying metrics and just want the most recent data point (like what
    is seen in the Grafana Explore table view), then you should use the
    &amp;#34;instant-query&amp;#34; command instead.

  instant-query [&amp;lt;flags&amp;gt;] &amp;lt;query&amp;gt;
    Run an instant LogQL query.

    The &amp;#34;instant-query&amp;#34; command is useful for evaluating a metric query for a
    single point in time. This is equivalent to the Grafana Explore table view;
    if you want a metrics query that is used to build a Grafana graph, you
    should use the &amp;#34;query&amp;#34; command instead.

    This command does not produce useful output when querying for log lines; you
    should always use the &amp;#34;query&amp;#34; command when you are running log queries.

    For more information about log queries and metric queries, refer to the
    LogQL documentation:

    https://grafana.com/docs/loki/latest/logql/

  labels [&amp;lt;flags&amp;gt;] [&amp;lt;label&amp;gt;]
    Find values for a given label.

  series [&amp;lt;flags&amp;gt;] &amp;lt;matcher&amp;gt;
    Run series query.

    The &amp;#34;series&amp;#34; command will take the provided label matcher and return all the
    log streams found in the time window.

    It is possible to send an empty label matcher &amp;#39;{}&amp;#39; to return all streams.

    Use the --analyze-labels flag to get a summary of the labels found in all
    streams. This is helpful to find high cardinality labels.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;logcli-query-command-reference&#34;&gt;LogCLI query command reference&lt;/h3&gt;
&lt;p&gt;The output of &lt;code&gt;logcli help query&lt;/code&gt;:&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;usage: logcli query [&amp;lt;flags&amp;gt;] &amp;lt;query&amp;gt;

Run a LogQL query.

The &amp;#34;query&amp;#34; command is useful for querying for logs. Logs can be returned in a
few output modes:

  raw: log line
  default: log timestamp &amp;#43; log labels &amp;#43; log line
  jsonl: JSON response from Loki API of log line

The output of the log can be specified with the &amp;#34;-o&amp;#34; flag, for example, &amp;#34;-o raw&amp;#34;
for the raw output format.

The &amp;#34;query&amp;#34; command will output extra information about the query and its
results, such as the API URL, set of common labels, and set of excluded labels.
This extra information can be suppressed with the --quiet flag.

By default we look over the last hour of data; use --since to modify or provide
specific start and end times with --from and --to respectively.

Notice that when using --from and --to then ensure to use RFC3339Nano time
format, but without timezone at the end. The local timezone will be added
automatically or if using --timezone flag.

Example:

  logcli query
     --timezone=UTC
     --from=&amp;#34;2021-01-19T10:00:00Z&amp;#34;
     --to=&amp;#34;2021-01-19T20:00:00Z&amp;#34;
     --output=jsonl
     &amp;#39;my-query&amp;#39;

The output is limited to 30 entries by default; use --limit to increase.

While &amp;#34;query&amp;#34; does support metrics queries, its output contains multiple data
points between the start and end query time. This output is used to build
graphs, similar to what is seen in the Grafana Explore graph view. If you are
querying metrics and just want the most recent data point (like what is seen in
the Grafana Explore table view), then you should use the &amp;#34;instant-query&amp;#34; command
instead.

Flags:
      --help               Show context-sensitive help (also try --help-long and
                           --help-man).
      --version            Show application version.
  -q, --quiet              Suppress query metadata
      --stats              Show query statistics
  -o, --output=default     Specify output mode [default, raw, jsonl]. raw
                           suppresses log labels and timestamp.
  -z, --timezone=Local     Specify the timezone to use when formatting output
                           timestamps [Local, UTC]
      --cpuprofile=&amp;#34;&amp;#34;      Specify the location for writing a CPU profile.
      --memprofile=&amp;#34;&amp;#34;      Specify the location for writing a memory profile.
      --stdin              Take input logs from stdin
      --addr=&amp;#34;http://localhost:3100&amp;#34;
                           Server address. Can also be set using LOKI_ADDR env
                           var.
      --username=&amp;#34;&amp;#34;        Username for HTTP basic auth. Can also be set using
                           LOKI_USERNAME env var.
      --password=&amp;#34;&amp;#34;        Password for HTTP basic auth. Can also be set using
                           LOKI_PASSWORD env var.
      --ca-cert=&amp;#34;&amp;#34;         Path to the server Certificate Authority. Can also be
                           set using LOKI_CA_CERT_PATH env var.
      --tls-skip-verify    Server certificate TLS skip verify.
      --cert=&amp;#34;&amp;#34;            Path to the client certificate. Can also be set using
                           LOKI_CLIENT_CERT_PATH env var.
      --key=&amp;#34;&amp;#34;             Path to the client certificate key. Can also be set
                           using LOKI_CLIENT_KEY_PATH env var.
      --org-id=&amp;#34;&amp;#34;          adds X-Scope-OrgID to API requests for representing
                           tenant ID. Useful for requesting tenant data when
                           bypassing an auth gateway.
      --limit=30           Limit on number of entries to print.
      --since=1h           Lookback window.
      --from=FROM          Start looking for logs at this absolute time
                           (inclusive)
      --to=TO              Stop looking for logs at this absolute time
                           (exclusive)
      --step=STEP          Query resolution step width, for metric queries.
                           Evaluate the query at the specified step over the
                           time range.
      --interval=INTERVAL  Query interval, for log queries. Return entries at
                           the specified interval, ignoring those between.
                           **This parameter is experimental, please see Issue
                           1779**
      --batch=1000         Query batch size to use until &amp;#39;limit&amp;#39; is reached
      --forward            Scan forwards through logs.
      --no-labels          Do not print any labels
      --exclude-label=EXCLUDE-LABEL ...
                           Exclude labels given the provided key during output.
      --include-label=INCLUDE-LABEL ...
                           Include labels given the provided key during output.
      --labels-length=0    Set a fixed padding to labels
      --store-config=&amp;#34;&amp;#34;    Execute the current query using a configured storage
                           from a given Loki configuration file.
      --colored-output     Show output with colored labels
  -t, --tail               Tail the logs
  -f, --follow             Alias for --tail
      --delay-for=0        Delay in tailing by number of seconds to accumulate
                           logs for re-ordering

Args:
  &amp;lt;query&amp;gt;  eg &amp;#39;{foo=&amp;#34;bar&amp;#34;,baz=~&amp;#34;.*blip&amp;#34;} |~ &amp;#34;.*error.*&amp;#34;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;logcli-labels-command-reference&#34;&gt;LogCLI labels command reference&lt;/h3&gt;
&lt;p&gt;The output of &lt;code&gt;logcli help labels&lt;/code&gt;:&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;usage: logcli labels [&amp;lt;flags&amp;gt;] [&amp;lt;label&amp;gt;]

Find values for a given label.

Flags:
      --help             Show context-sensitive help (also try --help-long and
                         --help-man).
      --version          Show application version.
  -q, --quiet            Suppress query metadata
      --stats            Show query statistics
  -o, --output=default   Specify output mode [default, raw, jsonl]. raw
                         suppresses log labels and timestamp.
  -z, --timezone=Local   Specify the timezone to use when formatting output
                         timestamps [Local, UTC]
      --cpuprofile=&amp;#34;&amp;#34;    Specify the location for writing a CPU profile.
      --memprofile=&amp;#34;&amp;#34;    Specify the location for writing a memory profile.
      --stdin            Take input logs from stdin
      --addr=&amp;#34;http://localhost:3100&amp;#34;
                         Server address. Can also be set using LOKI_ADDR env
                         var.
      --username=&amp;#34;&amp;#34;      Username for HTTP basic auth. Can also be set using
                         LOKI_USERNAME env var.
      --password=&amp;#34;&amp;#34;      Password for HTTP basic auth. Can also be set using
                         LOKI_PASSWORD env var.
      --ca-cert=&amp;#34;&amp;#34;       Path to the server Certificate Authority. Can also be
                         set using LOKI_CA_CERT_PATH env var.
      --tls-skip-verify  Server certificate TLS skip verify.
      --cert=&amp;#34;&amp;#34;          Path to the client certificate. Can also be set using
                         LOKI_CLIENT_CERT_PATH env var.
      --key=&amp;#34;&amp;#34;           Path to the client certificate key. Can also be set
                         using LOKI_CLIENT_KEY_PATH env var.
      --org-id=&amp;#34;&amp;#34;        adds X-Scope-OrgID to API requests for representing
                         tenant ID. Useful for requesting tenant data when
                         bypassing an auth gateway.
      --since=1h         Lookback window.
      --from=FROM        Start looking for labels at this absolute time
                         (inclusive)
      --to=TO            Stop looking for labels at this absolute time
                         (exclusive)

Args:
  [&amp;lt;label&amp;gt;]  The name of the label.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;logcli-series-command-reference&#34;&gt;LogCLI series command reference&lt;/h3&gt;
&lt;p&gt;The output of &lt;code&gt;logcli help series&lt;/code&gt;:&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;usage: logcli series [&amp;lt;flags&amp;gt;] &amp;lt;matcher&amp;gt;

Run series query.

The &amp;#34;series&amp;#34; command will take the provided label matcher and return all the log
streams found in the time window.

It is possible to send an empty label matcher &amp;#39;{}&amp;#39; to return all streams.

Use the --analyze-labels flag to get a summary of the labels found in all
streams. This is helpful to find high cardinality labels.

Flags:
      --help             Show context-sensitive help (also try --help-long and
                         --help-man).
      --version          Show application version.
  -q, --quiet            Suppress query metadata
      --stats            Show query statistics
  -o, --output=default   Specify output mode [default, raw, jsonl]. raw
                         suppresses log labels and timestamp.
  -z, --timezone=Local   Specify the timezone to use when formatting output
                         timestamps [Local, UTC]
      --cpuprofile=&amp;#34;&amp;#34;    Specify the location for writing a CPU profile.
      --memprofile=&amp;#34;&amp;#34;    Specify the location for writing a memory profile.
      --stdin            Take input logs from stdin
      --addr=&amp;#34;http://localhost:3100&amp;#34;
                         Server address. Can also be set using LOKI_ADDR env
                         var.
      --username=&amp;#34;&amp;#34;      Username for HTTP basic auth. Can also be set using
                         LOKI_USERNAME env var.
      --password=&amp;#34;&amp;#34;      Password for HTTP basic auth. Can also be set using
                         LOKI_PASSWORD env var.
      --ca-cert=&amp;#34;&amp;#34;       Path to the server Certificate Authority. Can also be
                         set using LOKI_CA_CERT_PATH env var.
      --tls-skip-verify  Server certificate TLS skip verify.
      --cert=&amp;#34;&amp;#34;          Path to the client certificate. Can also be set using
                         LOKI_CLIENT_CERT_PATH env var.
      --key=&amp;#34;&amp;#34;           Path to the client certificate key. Can also be set
                         using LOKI_CLIENT_KEY_PATH env var.
      --org-id=&amp;#34;&amp;#34;        adds X-Scope-OrgID to API requests for representing
                         tenant ID. Useful for requesting tenant data when
                         bypassing an auth gateway.
      --since=1h         Lookback window.
      --from=FROM        Start looking for logs at this absolute time
                         (inclusive)
      --to=TO            Stop looking for logs at this absolute time (exclusive)
      --analyze-labels   Printout a summary of labels including count of label
                         value combinations, useful for debugging high
                         cardinality series

Args:
  &amp;lt;matcher&amp;gt;  eg &amp;#39;{foo=&amp;#34;bar&amp;#34;,baz=~&amp;#34;.*blip&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;logcli---stdin-usage&#34;&gt;LogCLI &lt;code&gt;--stdin&lt;/code&gt; usage&lt;/h3&gt;
&lt;p&gt;You can consume log lines from your &lt;code&gt;stdin&lt;/code&gt; instead of Loki servers.&lt;/p&gt;
&lt;p&gt;Say you have log files in your local, and just want to do run some LogQL queries for that, &lt;code&gt;--stdin&lt;/code&gt; flag can help.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE: Currently it doesn&amp;rsquo;t support any type of metric queries&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You may have to use &lt;code&gt;stdin&lt;/code&gt; flag for several reasons&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Quick way to check and validate a LogQL expressions.&lt;/li&gt;
&lt;li&gt;Learn basics of LogQL with just Log files and &lt;code&gt;LogCLI&lt;/code&gt;tool ( without needing set up Loki servers, Grafana etc.)&lt;/li&gt;
&lt;li&gt;Easy discussion on public forums. Like Q&amp;amp;A, Share the LogQL expressions.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;NOTES on Usage&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;--limits&lt;/code&gt; flag doesn&amp;rsquo;t have any meaning when using &lt;code&gt;--stdin&lt;/code&gt; (use pager like &lt;code&gt;less&lt;/code&gt; for that)&lt;/li&gt;
&lt;li&gt;Be aware there are no &lt;strong&gt;labels&lt;/strong&gt; when using &lt;code&gt;--stdin&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;So stream selector in the query is optional e.g just &lt;code&gt;|=&amp;quot;timeout&amp;quot;|logfmt|level=&amp;quot;error&amp;quot;&lt;/code&gt; is same as &lt;code&gt;{foo=&amp;quot;bar&amp;quot;}|=&amp;quot;timeout|logfmt|level=&amp;quot;error&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Examples&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Line filter - &lt;code&gt;cat mylog.log | logcli --stdin query &#39;|=&amp;quot;too many open connections&amp;quot;&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Label matcher - &lt;code&gt;echo &#39;msg=&amp;quot;timeout happened&amp;quot; level=&amp;quot;warning&amp;quot;&#39; | logcli --stdin query &#39;|logfmt|level=&amp;quot;warning&amp;quot;&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Different parsers (logfmt, json, pattern, regexp) - &lt;code&gt;cat mylog.log | logcli --stdin query &#39;|pattern &amp;lt;ip&amp;gt; - - &amp;lt;_&amp;gt; &amp;quot;&amp;lt;method&amp;gt; &amp;lt;uri&amp;gt; &amp;lt;_&amp;gt;&amp;quot; &amp;lt;status&amp;gt; &amp;lt;size&amp;gt; &amp;lt;_&amp;gt; &amp;quot;&amp;lt;agent&amp;gt;&amp;quot; &amp;lt;_&amp;gt;&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Line formatters - &lt;code&gt;cat mylog.log | logcli --stdin query &#39;|logfmt|line_format &amp;quot;{{.query}} {{.duration}}&amp;quot;&#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="logcli-grafana-lokis-command-line-interface">LogCLI, Grafana Loki&amp;rsquo;s command-line interface&lt;/h1>
&lt;p>LogCLI is the command-line interface to Grafana Loki.
It facilitates running LogQL
queries against a Loki instance.&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;h3 id="binary-recommended">Binary (Recommended)&lt;/h3>
&lt;p>Download the &lt;code>logcli&lt;/code> binary from the
&lt;a href="https://github.com/grafana/loki/releases" target="_blank" rel="noopener noreferrer">Loki releases page&lt;/a>.&lt;/p></description></item><item><title>Fundamentals</title><link>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/fundamentals/</link><pubDate>Tue, 16 Jul 2024 15:42:20 +0000</pubDate><guid>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/fundamentals/</guid><content><![CDATA[&lt;h1 id=&#34;grafana-loki-fundamentals&#34;&gt;Grafana Loki Fundamentals&lt;/h1&gt;
]]></content><description>&lt;h1 id="grafana-loki-fundamentals">Grafana Loki Fundamentals&lt;/h1></description></item><item><title>Configuration</title><link>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/configuration/</link><pubDate>Tue, 16 Jul 2024 15:42:20 +0000</pubDate><guid>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/configuration/</guid><content><![CDATA[&lt;h1 id=&#34;configuring-grafana-loki&#34;&gt;Configuring Grafana Loki&lt;/h1&gt;
&lt;p&gt;Grafana Loki is configured in a YAML file (usually referred to as &lt;code&gt;loki.yaml&lt;/code&gt; )
which contains information on the Loki server and its individual components,
depending on which mode Loki is launched in.&lt;/p&gt;
&lt;p&gt;Configuration examples can be found in the &lt;a href=&#34;examples/&#34;&gt;Configuration Examples&lt;/a&gt; document.&lt;/p&gt;
&lt;h2 id=&#34;printing-loki-config-at-runtime&#34;&gt;Printing Loki Config At Runtime&lt;/h2&gt;
&lt;p&gt;If you pass Loki the flag &lt;code&gt;-print-config-stderr&lt;/code&gt; or &lt;code&gt;-log-config-reverse-order&lt;/code&gt;, (or &lt;code&gt;-print-config-stderr=true&lt;/code&gt;)
Loki will dump the entire config object it has created from the built in defaults combined first with
overrides from config file, and second by overrides from flags.&lt;/p&gt;
&lt;p&gt;The result is the value for every config object in the Loki config struct, which is very large&amp;hellip;&lt;/p&gt;
&lt;p&gt;Many values will not be relevant to your install such as storage configs which you are not using and which you did not define,
this is expected as every option has a default value if it is being used or not.&lt;/p&gt;
&lt;p&gt;This config is what Loki will use to run, it can be invaluable for debugging issues related to configuration and
is especially useful in making sure your config files and flags are being read and loaded properly.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;-print-config-stderr&lt;/code&gt; is nice when running Loki directly e.g. &lt;code&gt;./loki &lt;/code&gt; as you can get a quick output of the entire Loki config.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;-log-config-reverse-order&lt;/code&gt; is the flag we run Loki with in all our environments, the config entries are reversed so
that the order of configs reads correctly top to bottom when viewed in Grafana&amp;rsquo;s Explore.&lt;/p&gt;
&lt;h2 id=&#34;configuration-file-reference&#34;&gt;Configuration File Reference&lt;/h2&gt;
&lt;p&gt;To specify which configuration file to load, pass the &lt;code&gt;-config.file&lt;/code&gt; flag at the
command line. The value can be a list of comma separated paths, then the first
file that exists will be used.
If no &lt;code&gt;-config.file&lt;/code&gt; argument is specified, Loki will look up the &lt;code&gt;config.yaml&lt;/code&gt; in the
current working directory and the &lt;code&gt;config/&lt;/code&gt; sub-directory and try to use that.&lt;/p&gt;
&lt;p&gt;The file is written in &lt;a href=&#34;https://en.wikipedia.org/wiki/YAML&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;YAML
format&lt;/a&gt;, defined by the scheme below.
Brackets indicate that a parameter is optional. For non-list parameters the
value is set to the specified default.&lt;/p&gt;
&lt;h3 id=&#34;use-environment-variables-in-the-configuration&#34;&gt;Use environment variables in the configuration&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This feature is only available in Loki 2.1&#43;.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;You can use environment variable references in the configuration file to set values that need to be configurable during deployment.
To do this, pass &lt;code&gt;-config.expand-env=true&lt;/code&gt; and use:&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;${VAR}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Where VAR is the name of the environment variable.&lt;/p&gt;
&lt;p&gt;Each variable reference is replaced at startup by the value of the environment variable.
The replacement is case-sensitive and occurs before the YAML file is parsed.
References to undefined variables are replaced by empty strings unless you specify a default value or custom error text.&lt;/p&gt;
&lt;p&gt;To specify a default value, use:&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;${VAR:-default_value}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Where default_value is the value to use if the environment variable is undefined.&lt;/p&gt;
&lt;p&gt;Pass the &lt;code&gt;-config.expand-env&lt;/code&gt; flag at the command line to enable this way of setting configs.&lt;/p&gt;
&lt;h3 id=&#34;generic-placeholders&#34;&gt;Generic placeholders&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;boolean&amp;gt;&lt;/code&gt; : a boolean that can take the values &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;int&amp;gt;&lt;/code&gt; : any integer matching the regular expression &lt;code&gt;[1-9]&#43;[0-9]*&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;duration&amp;gt;&lt;/code&gt; : a duration matching the regular expression &lt;code&gt;[0-9]&#43;(ns|us|µs|ms|[smh])&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;labelname&amp;gt;&lt;/code&gt; : a string matching the regular expression &lt;code&gt;[a-zA-Z_][a-zA-Z0-9_]*&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;labelvalue&amp;gt;&lt;/code&gt; : a string of unicode characters&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;filename&amp;gt;&lt;/code&gt; : a valid path relative to current working directory or an absolute path.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;host&amp;gt;&lt;/code&gt; : a valid string consisting of a hostname or IP followed by an optional port number&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;string&amp;gt;&lt;/code&gt; : a string&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;secret&amp;gt;&lt;/code&gt; : a string that represents a secret, such as a password&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;supported-contents-and-default-values-of-lokiyaml&#34;&gt;Supported contents and default values of &lt;code&gt;loki.yaml&lt;/code&gt;&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;# A comma-separated list of components to run.
# The default value &amp;#34;all&amp;#34; runs Loki in single binary mode.
# The value &amp;#34;read&amp;#34; is an alias to run only read-path related components such as
# the querier and query-frontend, but all in the same process.
# The value &amp;#34;write&amp;#34; is an alias to run only write-path related components such as
# the distributor and compactor, but all in the same process.
# Supported values: all, compactor, distributor, ingester, querier, query-scheduler,
#  ingester-querier, query-frontend, index-gateway, ruler, table-manager, read, write.
# A full list of available targets can be printed when running Loki with the
# `-list-targets` command line flag.
[target: &amp;lt;string&amp;gt; | default = &amp;#34;all&amp;#34;]

# Enables authentication through the X-Scope-OrgID header, which must be present
# if true. If false, the OrgID will always be set to &amp;#34;fake&amp;#34;.
[auth_enabled: &amp;lt;boolean&amp;gt; | default = true]

# The amount of virtual memory in bytes to reserve as ballast in order to optimize
# garbage collection. Larger ballasts result in fewer garbage collection passes, reducing
# CPU overhead at the cost of heap size. The ballast will not consume physical memory,
# because it is never read from. It will, however, distort metrics, because it is
# counted as live memory.
[ballast_bytes: &amp;lt;int&amp;gt; | default = 0]

# Configures the server of the launched module(s).
[server: &amp;lt;server&amp;gt;]

# Configures the distributor.
[distributor: &amp;lt;distributor&amp;gt;]

# Configures the querier. Only appropriate when running all modules or
# just the querier.
[querier: &amp;lt;querier&amp;gt;]

# The query_scheduler block configures the Loki query scheduler.
# When configured it separates the tenant query queues from the query-frontend
[query_scheduler: &amp;lt;query_scheduler&amp;gt;]

# The frontend block configures the Loki query-frontend.
[frontend: &amp;lt;frontend&amp;gt;]

# The query_range block configures the query splitting and caching in the Loki
# query-frontend.
[query_range: &amp;lt;query_range&amp;gt;]

# The ruler block configures the Loki ruler.
[ruler: &amp;lt;ruler&amp;gt;]

# The ingester_client block configures how the distributor will connect
# to ingesters. Only appropriate when running all components, the distributor,
# or the querier.
[ingester_client: &amp;lt;ingester_client&amp;gt;]

# The ingester block configures the ingester and how the ingester will register itself
# to a key value store.
[ingester: &amp;lt;ingester&amp;gt;]

# Configures the index gateway server.
[index_gateway: &amp;lt;index_gateway&amp;gt;]

# Configures where Loki will store data.
[storage_config: &amp;lt;storage_config&amp;gt;]

# Configures how Loki will store data in the specific store.
[chunk_store_config: &amp;lt;chunk_store_config&amp;gt;]

# Configures the chunk index schema and where it is stored.
[schema_config: &amp;lt;schema_config&amp;gt;]

# The compactor block configures the compactor component, which compacts index shards
# for performance.
[compactor: &amp;lt;compactor&amp;gt;]

# Configures limits per-tenant or globally.
[limits_config: &amp;lt;limits_config&amp;gt;]

# The frontend_worker configures the worker - running within the Loki
# querier - picking up and executing queries enqueued by the query-frontend.
[frontend_worker: &amp;lt;frontend_worker&amp;gt;]

# The table_manager block configures the table manager for retention.
[table_manager: &amp;lt;table_manager&amp;gt;]

# Configuration for &amp;#34;runtime config&amp;#34; module, responsible for reloading runtime
# configuration file.
[runtime_config: &amp;lt;runtime_config&amp;gt;]

# Configuration for tracing.
[tracing: &amp;lt;tracing&amp;gt;]

# Common configuration to be shared between multiple modules.
# If a more specific configuration is given in other sections,
# the related configuration within this section will be ignored.
[common: &amp;lt;common&amp;gt;]

# Configuration for usage report
[analytics: &amp;lt;analytics&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;server&#34;&gt;server&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;server&lt;/code&gt; block
configures the HTTP and gRPC server communication of the launched service(s).&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;# HTTP server listen host
# CLI flag: -server.http-listen-address
[http_listen_address: &amp;lt;string&amp;gt;]

# HTTP server listen port
# CLI flag: -server.http-listen-port
[http_listen_port: &amp;lt;int&amp;gt; | default = 80]

# gRPC server listen host
# CLI flag: -server.grpc-listen-address
[grpc_listen_address: &amp;lt;string&amp;gt;]

# gRPC server listen port
# CLI flag: -server.grpc-listen-port
[grpc_listen_port: &amp;lt;int&amp;gt; | default = 9095]

# Register instrumentation handlers (/metrics, etc.)
# CLI flag: -server.register-instrumentation
[register_instrumentation: &amp;lt;boolean&amp;gt; | default = true]

# Timeout for graceful shutdowns
# CLI flag: -server.graceful-shutdown-timeout
[graceful_shutdown_timeout: &amp;lt;duration&amp;gt; | default = 30s]

# Read timeout for HTTP server
# CLI flag: -server.http-read-timeout
[http_server_read_timeout: &amp;lt;duration&amp;gt; | default = 30s]

# Write timeout for HTTP server
# CLI flag: -server.http-write-timeout
[http_server_write_timeout: &amp;lt;duration&amp;gt; | default = 30s]

# Idle timeout for HTTP server
# CLI flag: -server.http-idle-timeout
[http_server_idle_timeout: &amp;lt;duration&amp;gt; | default = 120s]

# Max gRPC message size that can be received
# CLI flag: -server.grpc-max-recv-msg-size-bytes
[grpc_server_max_recv_msg_size: &amp;lt;int&amp;gt; | default = 4194304]

# Max gRPC message size that can be sent
# CLI flag: -server.grpc-max-send-msg-size-bytes
[grpc_server_max_send_msg_size: &amp;lt;int&amp;gt; | default = 4194304]

# Limit on the number of concurrent streams for gRPC calls (0 = unlimited)
# CLI flag: -server.grpc-max-concurrent-streams
[grpc_server_max_concurrent_streams: &amp;lt;int&amp;gt; | default = 100]

# Log only messages with the given severity or above. Supported values [debug,
# info, warn, error]
# CLI flag: -log.level
[log_level: &amp;lt;string&amp;gt; | default = &amp;#34;info&amp;#34;]

# Base path to serve all API routes from (e.g., /v1/).
# CLI flag: -server.path-prefix
[http_path_prefix: &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;distributor&#34;&gt;distributor&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;distributor&lt;/code&gt; block configures the distributor component.&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 distributors ring, used when the &amp;#34;global&amp;#34; ingestion rate
# strategy is enabled.
ring:
  kvstore:
    # The backend storage to use for the ring. Supported values are
    # consul, etcd, inmemory, memberlist
    # CLI flag: -distributor.ring.store
    store: &amp;lt;string&amp;gt;

    # The prefix for the keys in the store. Should end with a /.
    # CLI flag: -distributor.ring.prefix
    [prefix: &amp;lt;string&amp;gt; | default = &amp;#34;collectors/&amp;#34;]

    # Configuration for a Consul client. Only applies if store is &amp;#34;consul&amp;#34;
    # The CLI flags prefix for this block config is: distributor.ring
    [consul: &amp;lt;consul_config&amp;gt;]

    # Configuration for an ETCD v3 client. Only applies if store is &amp;#34;etcd&amp;#34;
    # The CLI flags prefix for this block config is: distributor.ring
    [etcd: &amp;lt;etcd_config&amp;gt;]

  # The heartbeat timeout after which ingesters are skipped for
  # reading and writing.
  # CLI flag: -distributor.ring.heartbeat-timeout
  [heartbeat_timeout: &amp;lt;duration&amp;gt; | default = 1m]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;querier&#34;&gt;querier&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;querier&lt;/code&gt; block configures the Loki Querier.&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;# Timeout when querying ingesters or storage during the execution of a query request.
# CLI flag: -querier.query-timeout
[query_timeout: &amp;lt;duration&amp;gt; | default = 1m]

# Maximum duration for which the live tailing requests should be served.
# CLI flag: -querier.tail-max-duration
[tail_max_duration: &amp;lt;duration&amp;gt; | default = 1h]

# Time to wait before sending more than the minimum successful query requests.
# CLI flag: -querier.extra-query-delay
[extra_query_delay: &amp;lt;duration&amp;gt; | default = 0s]

# Maximum lookback beyond which queries are not sent to ingester.
# 0 means all queries are sent to ingester.
# CLI flag: -querier.query-ingesters-within
[query_ingesters_within: &amp;lt;duration&amp;gt; | default = 3h]

# The maximum number of concurrent queries allowed.
# CLI flag: -querier.max-concurrent
[max_concurrent: &amp;lt;int&amp;gt; | default = 10]

# Only query the store, and not attempt any ingesters.
# This is useful for running a standalone querier pool operating only against
# stored data.
# CLI flag: -querier.query-store-only
[query_store_only: &amp;lt;boolean&amp;gt; | default = false]

# When true, queriers only query the ingesters, and not stored data.
# This is useful when the object store is unavailable.
# CLI flag: -querier.query-ingester-only
[query_ingester_only: &amp;lt;boolean&amp;gt; | default = false]

# When true, allow queries to span multiple tenants.
# CLI flag: -querier.multi-tenant-queries-enabled
[multi_tenant_queries_enabled: &amp;lt;boolean&amp;gt; | default = false]

# Configuration options for the LogQL engine.
engine:
  # Timeout for query execution
  # CLI flag: -querier.engine.timeout
  [timeout: &amp;lt;duration&amp;gt; | default = 3m]

  # The maximum amount of time to look back for log lines. Only
  # applicable for instant log queries.
  # CLI flag: -querier.engine.max-lookback-period
  [max_look_back_period: &amp;lt;duration&amp;gt; | default = 30s]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;query_scheduler&#34;&gt;query_scheduler&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;query_scheduler&lt;/code&gt; block configures the Loki query scheduler.&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;# Maximum number of outstanding requests per tenant per query-scheduler.
# In-flight requests above this limit will fail with HTTP response status code
# 429.
# CLI flag: -query-scheduler.max-outstanding-requests-per-tenant
[max_outstanding_requests_per_tenant: &amp;lt;int&amp;gt; | default = 100]

# If a querier disconnects without sending notification about graceful shutdown,
# the query-scheduler will keep the querier in the tenant&amp;#39;s shard until the forget delay has passed.
# This feature is useful to reduce the blast radius when shuffle-sharding is enabled.
# CLI flag: -query-scheduler.querier-forget-delay
[querier_forget_delay: &amp;lt;duration&amp;gt; | default = 0]

# This configures the gRPC client used to report errors back to the
# query-frontend.
[grpc_client_config: &amp;lt;grpc_client_config&amp;gt;]

# Set to true to have the query schedulers create and place themselves in a ring.
# If no frontend_address or scheduler_address are present
# anywhere else in the configuration, Loki will toggle this value to true.
[use_scheduler_ring: &amp;lt;boolean&amp;gt; | default = false]

# The hash ring configuration. This option is required only if use_scheduler_ring is true
# The CLI flags prefix for this block config is scheduler.ring
[scheduler_ring: &amp;lt;ring&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;frontend&#34;&gt;frontend&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;frontend&lt;/code&gt; block configures the Loki query-frontend.&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;# Maximum number of outstanding requests per tenant per frontend; requests
# beyond this error with HTTP 429.
# CLI flag: -querier.max-outstanding-requests-per-tenant
[max_outstanding_per_tenant: &amp;lt;int&amp;gt; | default = 2048]

# In the event a tenant is repeatedly sending queries that lead the querier to crash
# or be killed due to an out-of-memory error, the crashed querier will be disconnected
# from the query frontend and a new querier will be immediately assigned to the tenant’s shard.
# This invalidates the assumption that shuffle sharding can be used to reduce the
# impact on tenants. This option mitigates the impact by configuring a delay between when
# a querier disconnects because of a crash and when the crashed querier is actually removed
# from the tenant&amp;#39;s shard.
# CLI flag: -query-frontend.querier-forget-delay
[querier_forget_delay: &amp;lt;duration&amp;gt; | default = 0s]

# Compress HTTP responses.
# CLI flag: -querier.compress-http-responses
[compress_responses: &amp;lt;boolean&amp;gt; | default = false]

# URL of downstream Loki.
# CLI flag: -frontend.downstream-url
[downstream_url: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Log queries that are slower than the specified duration. Set to 0 to disable.
# Set to &amp;lt; 0 to enable on all queries.
# CLI flag: -frontend.log-queries-longer-than
[log_queries_longer_than: &amp;lt;duration&amp;gt; | default = 0s]

# URL of querier for tail proxy.
# CLI flag: -frontend.tail-proxy-url
[tail_proxy_url: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

tail_tls_config:
  # Path to the client certificate file, which will be used for authenticating
  # with the server. Also requires the key path to be configured.
  # CLI flag: -frontend.tail-tls-config.tls-cert-path
  [tls_cert_path: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]
  
  # Path to the key file for the client certificate. Also requires the client
  # certificate to be configured.
  # CLI flag: -frontend.tail-tls-config.tls-key-path
  [tls_key_path: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]
  # Path to the CA certificates file to validate server certificate against. If
  # not set, the host&amp;#39;s root CA certificates are used.
  # CLI flag: -frontend.tail-tls-config.tls-ca-path
  [tls_ca_path: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]
  # Skip validating server certificate.
  # CLI flag: -frontend.tail-tls-config.tls-insecure-skip-verify
  [tls_insecure_skip_verify: &amp;lt;boolean&amp;gt; | default = false]

# DNS hostname used for finding query-schedulers.
# CLI flag: -frontend.scheduler-address
[scheduler_address: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# How often to resolve the scheduler-address, in order to look for new
# query-scheduler instances.
# Also used to determine how often to poll the scheduler-ring for addresses if configured.
# CLI flag: -frontend.scheduler-dns-lookup-period
[scheduler_dns_lookup_period: &amp;lt;duration&amp;gt; | default = 10s]

# Number of concurrent workers forwarding queries to single query-scheduler.
# CLI flag: -frontend.scheduler-worker-concurrency
[scheduler_worker_concurrency: &amp;lt;int&amp;gt; | default = 5]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;query_range&#34;&gt;query_range&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;query_range&lt;/code&gt; block configures query splitting and caching in the Loki query-frontend.&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;# Deprecated: Split queries by day and execute in parallel.
# Use -querier.split-queries-by-interval instead.
# CLI flag: -querier.split-queries-by-day
[split_queries_by_day: &amp;lt;boolean&amp;gt; | default = false]

# Mutate incoming queries to align their start and end with their step.
# CLI flag: -querier.align-querier-with-step
[align_queries_with_step: &amp;lt;boolean&amp;gt; | default = false]

results_cache:
  # The CLI flags prefix for this block config is: frontend
  cache: &amp;lt;cache_config&amp;gt;

# Cache query results.
# CLI flag: -querier.cache-results
[cache_results: &amp;lt;boolean&amp;gt; | default = false]

# Maximum number of retries for a single request; beyond this, the downstream
# error is returned.
# CLI flag: -querier.max-retries-per-request
[max_retries: &amp;lt;int&amp;gt; | default = 5]

# Perform query parallelisations based on storage sharding configuration and
# query ASTs. This feature is supported only by the chunks storage engine.
# CLI flag: -querier.parallelise-shardable-queries
[parallelise_shardable_queries: &amp;lt;boolean&amp;gt; | default = true]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;ruler&#34;&gt;ruler&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;ruler&lt;/code&gt; block configures the Loki ruler.&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;# URL of alerts return path.
# CLI flag: -ruler.external.url
[external_url: &amp;lt;url&amp;gt; | default = ]

# Labels to add to all alerts
external_labels:
  [&amp;lt;labelname&amp;gt;: &amp;lt;labelvalue&amp;gt; ...]

ruler_client:
  # Path to the client certificate file, which will be used for authenticating
  # with the server. Also requires the key path to be configured.
  # CLI flag: -ruler.client.tls-cert-path
  [tls_cert_path: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Path to the key file for the client certificate. Also requires the client
  # certificate to be configured.
  # CLI flag: -ruler.client.tls-key-path
  [tls_key_path: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Path to the CA certificates file to validate server certificate against. If
  # not set, the host&amp;#39;s root CA certificates are used.
  # CLI flag: -ruler.client.tls-ca-path
  [tls_ca_path: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Skip validating server certificate.
  # CLI flag: -ruler.client.tls-insecure-skip-verify
  [tls_insecure_skip_verify: &amp;lt;boolean&amp;gt; | default = false]

# How frequently to evaluate rules.
# CLI flag: -ruler.evaluation-interval
[evaluation_interval: &amp;lt;duration&amp;gt; | default = 1m]

# How frequently to poll for rule changes.
# CLI flag: -ruler.poll-interval
[poll_interval: &amp;lt;duration&amp;gt; | default = 1m]

storage:
  # Method to use for backend rule storage (azure, gcs, s3, swift, local, bos).
  # CLI flag: -ruler.storage.type
  [type: &amp;lt;string&amp;gt; ]

  # Configures backend rule storage for Azure.
  [azure: &amp;lt;azure_storage_config&amp;gt;]

  # Configures backend rule storage for GCS.
  [gcs: &amp;lt;gcs_storage_config&amp;gt;]

  # Configures backend rule storage for S3.
  [s3: &amp;lt;s3_storage_config&amp;gt;]

  # Configures backend rule storage for Swift.
  [swift: &amp;lt;swift_storage_config&amp;gt;]

  # Configures backend rule storage for a local file system directory.
  [local: &amp;lt;local_storage_config&amp;gt;]

  # Configures backend rule storage for Baidu Object Storage (BOS).
  [bos: &amp;lt;bos_storage_config&amp;gt;]

  # The `hedging` block configures how to hedge storage requests.
  [hedging: &amp;lt;hedging&amp;gt;]

# Remote-write configuration to send rule samples to a Prometheus remote-write endpoint.
remote_write:
  # Enable remote-write functionality.
  # CLI flag: -ruler.remote-write.enabled
  [enabled: &amp;lt;boolean&amp;gt; | default = false]
  # Minimum period to wait between refreshing remote-write reconfigurations.
  # This should be greater than or equivalent to -limits.per-user-override-period.
  [config_refresh_period: &amp;lt;duration&amp;gt; | default = 10s]

  client:
    # The URL of the endpoint to send samples to.
    url: &amp;lt;string&amp;gt;

    # Timeout for requests to the remote write endpoint.
    [remote_timeout: &amp;lt;duration&amp;gt; | default = 30s]

    # Custom HTTP headers to be sent along with each remote write request.
    # Be aware that headers that are set by Loki itself can&amp;#39;t be overwritten.
    headers:
      [&amp;lt;string&amp;gt;: &amp;lt;string&amp;gt; ...]

    # List of remote write relabel configurations.
    write_relabel_configs:
      [- &amp;lt;relabel_config&amp;gt; ...]

    # Name of the remote write config, which if specified must be unique among remote
    # write configs.
    # The name will be used in metrics and logging in place of a generated value
    # to help users distinguish between remote write configs.
    [name: &amp;lt;string&amp;gt;]

    # Sets the `Authorization` header on every remote write request 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;]

    # Optional `Authorization` header configuration.
    authorization:
      # Sets the authentication type.
      [type: &amp;lt;string&amp;gt; | default: Bearer]
      # Sets the credentials. It is mutually exclusive with
      # `credentials_file`.
      [credentials: &amp;lt;secret&amp;gt;]
      # Sets the credentials to the credentials read from the configured file.
      # It is mutually exclusive with `credentials`.
      [credentials_file: &amp;lt;filename&amp;gt;]

    # Optionally configures AWS&amp;#39;s Signature Verification 4 signing process to
    # sign requests. Cannot be set at the same time as basic_auth, authorization, or oauth2.
    # To use the default credentials from the AWS SDK, use `sigv4: {}`.
    sigv4:
      # The AWS region. If blank, the region from the default credentials chain
      # is used.
      [region: &amp;lt;string&amp;gt;]

      # The AWS API keys. If blank, the environment variables `AWS_ACCESS_KEY_ID`
      # and `AWS_SECRET_ACCESS_KEY` are used.
      [access_key: &amp;lt;string&amp;gt;]
      [secret_key: &amp;lt;secret&amp;gt;]

      # Named AWS profile used to authenticate.
      [profile: &amp;lt;string&amp;gt;]

      # AWS Role ARN, an alternative to using AWS API keys.
      [role_arn: &amp;lt;string&amp;gt;]

    # Configures the remote write request&amp;#39;s TLS settings.
    tls_config:
      # CA certificate to validate API server certificate with.
      [ca_file: &amp;lt;filename&amp;gt;]
      # Certificate and key files for client cert authentication to the server.
      [cert_file: &amp;lt;filename&amp;gt;]
      [key_file: &amp;lt;filename&amp;gt;]
      # ServerName extension to indicate the name of the server.
      # https://tools.ietf.org/html/rfc4366#section-3.1
      [server_name: &amp;lt;string&amp;gt;]
      # Disable validation of the server certificate.
      [insecure_skip_verify: &amp;lt;boolean&amp;gt;]

    # Optional proxy URL.
    [proxy_url: &amp;lt;string&amp;gt;]

    # Configure whether HTTP requests follow HTTP 3xx redirects.
    [follow_redirects: &amp;lt;boolean&amp;gt; | default = true]

    # Configures the queue used to write to remote storage.
    queue_config:
      # Number of samples to buffer per shard before we block reading of more
      # samples from the WAL. It is recommended to have enough capacity in each
      # shard to buffer several requests to keep throughput up while processing
      # occasional slow remote requests.
      [capacity: &amp;lt;int&amp;gt; | default = 2500]
      # Maximum number of shards, i.e. amount of concurrency.
      [max_shards: &amp;lt;int&amp;gt; | default = 200]
      # Minimum number of shards, i.e. amount of concurrency.
      [min_shards: &amp;lt;int&amp;gt; | default = 1]
      # Maximum number of samples per send.
      [max_samples_per_send: &amp;lt;int&amp;gt; | default = 500]
      # Maximum time a sample will wait in buffer.
      [batch_send_deadline: &amp;lt;duration&amp;gt; | default = 5s]
      # Initial retry delay. Gets doubled for every retry.
      [min_backoff: &amp;lt;duration&amp;gt; | default = 30ms]
      # Maximum retry delay.
      [max_backoff: &amp;lt;duration&amp;gt; | default = 100ms]
      # Retry upon receiving a 429 status code from the remote-write storage.
      # This is experimental and might change in the future.
      [retry_on_http_429: &amp;lt;boolean&amp;gt; | default = false]

wal:
  # The directory in which to write tenant WAL files. Each tenant will have its own
  # directory one level below this directory.
  [dir: &amp;lt;string&amp;gt; | default = &amp;#34;ruler-wal&amp;#34;]
  # Frequency with which to run the WAL truncation process.
  [truncate_frequency: &amp;lt;duration&amp;gt; | default = 60m]
  # Minimum and maximum time series should exist in the WAL for.
  [min_age: &amp;lt;duration&amp;gt; | default = 5m]
  [max_age: &amp;lt;duration&amp;gt; | default = 4h]

wal_cleaner:
  # The minimum age of a WAL to consider for cleaning.
  [min_age: &amp;lt;duration&amp;gt; | default = 12h]
  # How often to run the WAL cleaner.
  [period: &amp;lt;duration&amp;gt; | default = 0s (disabled)]

# File path to store temporary rule files.
# CLI flag: -ruler.rule-path
[rule_path: &amp;lt;filename&amp;gt; | default = &amp;#34;/rules&amp;#34;]

# Comma-separated list of Alertmanager URLs to send notifications to.
# Each Alertmanager URL is treated as a separate group in the configuration.
# Multiple Alertmanagers in HA per group can be supported by using DNS
# resolution via -ruler.alertmanager-discovery.
# CLI flag: -ruler.alertmanager-url
[alertmanager_url: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]


alertmanager_client:
  # Sets the `Authorization` header on every remote write request 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;]

  # Optional `Authorization` header configuration.
  authorization:
    # Sets the authentication type.
    [type: &amp;lt;string&amp;gt; | default: Bearer]
    # Sets the credentials. It is mutually exclusive with
    # `credentials_file`.
    [credentials: &amp;lt;secret&amp;gt;]
    # Sets the credentials to the credentials read from the configured file.
    # It is mutually exclusive with `credentials`.
    [credentials_file: &amp;lt;filename&amp;gt;]

# Use DNS SRV records to discover Alertmanager hosts.
# CLI flag: -ruler.alertmanager-discovery
[enable_alertmanager_discovery: &amp;lt;boolean&amp;gt; | default = false]

# How long to wait between refreshing DNS resolutions of Alertmanager hosts.
# CLI flag: -ruler.alertmanager-refresh-interval
[alertmanager_refresh_interval: &amp;lt;duration&amp;gt; | default = 1m]

# If enabled, then requests to Alertmanager use the v2 API.
# CLI flag: -ruler.alertmanager-use-v2
[enable_alertmanager_v2: &amp;lt;boolean&amp;gt; | default = false]

# List of alert relabel configs
alert_relabel_configs:
  [- &amp;lt;relabel_config&amp;gt; ...]

# Capacity of the queue for notifications to be sent to the Alertmanager.
# CLI flag: -ruler.notification-queue-capacity
[notification_queue_capacity: &amp;lt;int&amp;gt; | default = 10000]

# HTTP timeout duration when sending notifications to the Alertmanager.
# CLI flag: -ruler.notification-timeout
[notification_timeout: &amp;lt;duration&amp;gt; | default = 10s]

# Max time to tolerate outage for restoring &amp;#34;for&amp;#34; state of alert.
# CLI flag: -ruler.for-outage-tolerance
[for_outage_tolerance: &amp;lt;duration&amp;gt; | default = 1h]

# Minimum duration between alert and restored &amp;#34;for&amp;#34; state. This is maintained
# only for alerts with configured &amp;#34;for&amp;#34; time greater than the grace period.
# CLI flag: -ruler.for-grace-period
[for_grace_period: &amp;lt;duration&amp;gt; | default = 10m]

# Minimum amount of time to wait before resending an alert to Alertmanager.
# CLI flag: -ruler.resend-delay
[resend_delay: &amp;lt;duration&amp;gt; | default = 1m]

# Distribute rule evaluation using ring backend.
# CLI flag: -ruler.enable-sharding
[enable_sharding: &amp;lt;boolean&amp;gt; | default = false]

# Time to spend searching for a pending ruler when shutting down.
# CLI flag: -ruler.search-pending-for
[search_pending_for: &amp;lt;duration&amp;gt; | default = 5m]

# Ring used by Loki ruler.
# The CLI flags prefix for this block config is ruler.ring
ring:
  kvstore:
    # Backend storage to use for the ring. Supported values are: consul, etcd,
    # inmemory, memberlist, multi.
    # CLI flag: -&amp;lt;prefix&amp;gt;.store
    [store: &amp;lt;string&amp;gt; | default = &amp;#34;memberlist&amp;#34;]

    # The prefix for the keys in the store. Should end with a /.
    # CLI flag: -&amp;lt;prefix&amp;gt;.prefix
    [prefix: &amp;lt;string&amp;gt; | default = &amp;#34;collectors/&amp;#34;]

    # The consul_config configures the consul client.
    [consul: &amp;lt;consul_config&amp;gt;]

    # The etcd_config configures the etcd client.
    [etcd: &amp;lt;etcd_config&amp;gt;]

    multi:
      # Primary backend storage used by multi-client.
      # CLI flag: -&amp;lt;prefix&amp;gt;.multi.primary
      [primary: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

      # Secondary backend storage used by multi-client.
      # CLI flag: -&amp;lt;prefix&amp;gt;.multi.secondary
      [secondary: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

      # Mirror writes to secondary store.
      # CLI flag: -&amp;lt;prefix&amp;gt;.multi.mirror-enabled
      [mirror_enabled: &amp;lt;boolean&amp;gt; | default = false]

      # Timeout for storing value to secondary store.
      # CLI flag: -&amp;lt;prefix&amp;gt;.multi.mirror-timeout
      [mirror_timeout: &amp;lt;duration&amp;gt; | default = 2s]

  # Interval between heartbeats sent to the ring. 0 = disabled.
  # CLI flag: -&amp;lt;prefix&amp;gt;.heartbeat-period
  [heartbeat_period: &amp;lt;duration&amp;gt; | default = 15s]

  # The heartbeat timeout after which ruler ring members are considered unhealthy
  # within the ring. 0 = never (timeout disabled).
  # CLI flag: -&amp;lt;prefix&amp;gt;.heartbeat-timeout
  [heartbeat_timeout: &amp;lt;duration&amp;gt; | default = 1m]

  # Name of network interface to read addresses from.
  # CLI flag: -&amp;lt;prefix&amp;gt;.instance-interface-names
  [instance_interface_names: &amp;lt;list of string&amp;gt; | default = [&amp;lt;private network interfaces&amp;gt;]]

  # The number of tokens the lifecycler will generate and put into the ring if
  # it joined without transferring tokens from another lifecycler.
  # CLI flag: -&amp;lt;prefix&amp;gt;.num-tokens
  [num_tokens: &amp;lt;int&amp;gt; | default = 128]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;bos_storage_config&#34;&gt;bos_storage_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;bos_storage_config&lt;/code&gt; block configures Baidu Object Storage (BOS)  as general storage for data generated by Loki.&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 BOS bucket.
# CLI flag: &amp;lt;prefix&amp;gt;.baidubce.bucket-name
[ bucket_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34; ]
# BOS endpoint to connect to.
# CLI flag: &amp;lt;prefix&amp;gt;.baidubce.endpoint
[ endpoint: &amp;lt;string&amp;gt; | default = &amp;#34;bj.bcebos.com&amp;#34; ]
# Baidu Cloud Engine (BCE) Access Key ID
# CLI flag: &amp;lt;prefix&amp;gt;.baidubce.access-key-id
[ access_key_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34; ]
# BCE Secret Access Key
# CLI flag: &amp;lt;prefix&amp;gt;.baidubce.secret-access-key
[ secret_access_key: &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;azure_storage_config&#34;&gt;azure_storage_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;azure_storage_config&lt;/code&gt; configures Azure as a general storage for different data generated by Loki.&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;# Azure Cloud environment. Supported values are: AzureGlobal,
# AzureChinaCloud, AzureGermanCloud, AzureUSGovernment.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.environment
[environment: &amp;lt;string&amp;gt; | default = &amp;#34;AzureGlobal&amp;#34;]

# Azure storage account name.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.account-name
[account_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Azure storage account key.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.account-key
[account_key: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Name of the storage account blob container used to store chunks.
# This container must be created before running Loki.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.container-name
[container_name: &amp;lt;string&amp;gt; | default = &amp;#34;loki&amp;#34;]

# Azure storage endpoint suffix without schema. The storage account name will
# be prefixed to this value to create the FQDN.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.endpoint-suffix
[endpoint_suffix: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Use Managed Identity to authenticate to the Azure storage account.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.use-managed-identity
[use_managed_identity: &amp;lt;boolean&amp;gt; | default = false]

# User assigned identity ID to authenticate to the Azure storage account.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.user-assigned-id
[user_assigned_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Chunk delimiter to build the blobID
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.chunk-delimiter
[chunk_delimiter: &amp;lt;string&amp;gt; | default = &amp;#34;-&amp;#34;]

# Preallocated buffer size for downloads.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.download-buffer-size
[download_buffer_size: &amp;lt;int&amp;gt; | default = 512000]

# Preallocated buffer size for uploads.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.upload-buffer-size
[upload_buffer_size: &amp;lt;int&amp;gt; | default = 256000]

# Number of buffers used to used to upload a chunk.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.download-buffer-count
[upload_buffer_count: &amp;lt;int&amp;gt; | default = 1]

# Timeout for requests made against azure blob storage.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.request-timeout
[request_timeout: &amp;lt;duration&amp;gt; | default = 30s]

# Number of retries for a request which times out.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.max-retries
[max_retries: &amp;lt;int&amp;gt; | default = 5]

# Minimum time to wait before retrying a request.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.min-retry-delay
[min_retry_delay: &amp;lt;duration&amp;gt; | default = 10ms]

# Maximum time to wait before retrying a request.
# CLI flag: -&amp;lt;prefix&amp;gt;.azure.max-retry-delay
[max_retry_delay: &amp;lt;duration&amp;gt; | default = 500ms]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;gcs_storage_config&#34;&gt;gcs_storage_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;gcs_storage_config&lt;/code&gt; configures GCS as a general storage for different data generated by Loki.&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 GCS bucket to put chunks in.
# CLI flag: -&amp;lt;prefix&amp;gt;.gcs.bucketname
[bucket_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# The size of the buffer that GCS client for each PUT request. 0 to disable
# buffering.
# CLI flag: -&amp;lt;prefix&amp;gt;.gcs.chunk-buffer-size
[chunk_buffer_size: &amp;lt;int&amp;gt; | default = 0]

# The duration after which the requests to GCS should be timed out.
# CLI flag: -&amp;lt;prefix&amp;gt;.gcs.request-timeout
[request_timeout: &amp;lt;duration&amp;gt; | default = 0s]

# Enable HTTP/2 when connecting to GCS. This configuration only applies to GET operations.
# CLI flag: -&amp;lt;prefix&amp;gt;.gcs.enable-http2
[enable_http2: &amp;lt;boolean&amp;gt; | default = true]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;s3_storage_config&#34;&gt;s3_storage_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;s3_storage_config&lt;/code&gt; configures S3 as a general storage for different data generated by Loki.&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;# S3 endpoint URL with escaped Key and Secret encoded. If only region is
# specified as a host, proper endpoint will be deduced. Use
# inmemory:///&amp;lt;bucket-name&amp;gt; to use a mock in-memory implementation.
# CLI flag: -&amp;lt;prefix&amp;gt;.s3.url
[s3: &amp;lt;url&amp;gt; | default = ]

# Set this to `true` to force the request to use path-style addressing.
# CLI flag: -&amp;lt;prefix&amp;gt;.s3.force-path-style
[s3forcepathstyle: &amp;lt;boolean&amp;gt; | default = false]

# Comma separated list of bucket names to evenly distribute chunks over.
# Overrides any buckets specified in s3.url flag
# CLI flag: -&amp;lt;prefix&amp;gt;.s3.buckets
[bucketnames: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# S3 Endpoint to connect to.
# CLI flag: -&amp;lt;prefix&amp;gt;.s3.endpoint
[endpoint: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# AWS region to use.
# CLI flag: -&amp;lt;prefix&amp;gt;.s3.region
[region: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# AWS Access Key ID
# CLI flag: -&amp;lt;prefix&amp;gt;.s3.access-key-id
[access_key_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# AWS Secret Access Key
# CLI flag: -&amp;lt;prefix&amp;gt;.s3.secret-access-key
[secret_access_key: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Disable https on S3 connection.
# CLI flag: -&amp;lt;prefix&amp;gt;.s3.insecure
[insecure: &amp;lt;boolean&amp;gt; | default = false]

# Enable AES256 AWS server-side encryption
# CLI flag: -&amp;lt;prefix&amp;gt;.s3.sse-encryption
[sse_encryption: &amp;lt;boolean&amp;gt; | default = false]

http_config:
  # The maximum amount of time an idle connection will be held open.
  # CLI flag: -&amp;lt;prefix&amp;gt;.s3.http.idle-conn-timeout
  [idle_conn_timeout: &amp;lt;duration&amp;gt; | default = 1m30s]

  # If non-zero, specifies the amount of time to wait for a server&amp;#39;s
  # response headers after fully writing the request.
  # CLI flag: -&amp;lt;prefix&amp;gt;.s3.http.response-header-timeout
  [response_header_timeout: &amp;lt;duration&amp;gt; | default = 0s]

  # Set to true to skip verifying the certificate chain and hostname.
  # CLI flag: -&amp;lt;prefix&amp;gt;.s3.http.insecure-skip-verify
  [insecure_skip_verify: &amp;lt;boolean&amp;gt; | default = false]

  # Path to the trusted CA file that signed the SSL certificate of the S3
  # endpoint.
  # CLI flag: -&amp;lt;prefix&amp;gt;.s3.http.ca-file
  [ca_file: &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;swift_storage_config&#34;&gt;swift_storage_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;swift_storage_config&lt;/code&gt; configures Swift as a general storage for different data generated by Loki.&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;# Openstack authentication URL.
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.auth-url
[auth_url: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Openstack username for the api.
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.username
[username: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Openstack user&amp;#39;s domain name.
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.user-domain-name
[user_domain_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Openstack user&amp;#39;s domain ID.
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.user-domain-id
[user_domain_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Openstack user ID for the API.
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.user-id
[user_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Openstack API key.
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.password
[password: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Openstack user&amp;#39;s domain ID.
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.domain-id
[domain_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Openstack user&amp;#39;s domain name.
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.domain-name
[domain_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Openstack project ID (v2,v3 auth only).
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.project-id
[project_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Openstack project name (v2,v3 auth only).
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.project-name
[project_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# ID of the project&amp;#39;s domain (v3 auth only), only needed if it differs the
# from user domain.
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.project-domain-id
[project_domain_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Name of the project&amp;#39;s domain (v3 auth only), only needed if it differs
# from the user domain.
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.project-domain-name
[project_domain_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Openstack Region to use eg LON, ORD - default is use first region (v2,v3
# auth only)
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.region-name
[region_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Name of the Swift container to put chunks in.
# CLI flag: -&amp;lt;prefix&amp;gt;.swift.container-name
[container_name: &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;hedging&#34;&gt;hedging&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;hedging&lt;/code&gt; block configures how to hedge storage requests.&lt;/p&gt;
&lt;p&gt;The hedging implementation sends a second storage request once a first request has
been outstanding for more than a configured expected latency for this class of requests.
Calculate your latency to be the 99th percentile of object storage response times.&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;# An optional duration that sets the quantity of time after a first storage request
# is sent and before a second request is sent, when no response is received for the first
# storage request. The recommended duration is the measured 99th percentile of object
# storage response times, to reduce long tail latency. This option is most impactful
# when used with queriers, and has minimal to no impact on other components.
# The default value of 0 disables the hedging of storage requests.
# Example: &amp;#34;at: 500ms&amp;#34;
[at: &amp;lt;duration&amp;gt; | default = 0]

# An optional maximum quantity of hedged requests to be issued for a given request.
[up_to: &amp;lt;int&amp;gt; | default = 2]

# Caps the rate of hedged requests by optionally defining the maximum quantity of
# hedged requests issued per second.
[max_per_second: &amp;lt;int&amp;gt; | default = 5]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;local_storage_config&#34;&gt;local_storage_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;local_storage_config&lt;/code&gt; configures a (local) file system as a general storage for different data generated by Loki.&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;# Filesystem directory to be used as storage.
# CLI flag: -&amp;lt;prefix&amp;gt;.local.directory
[directory: &amp;lt;filename&amp;gt; | default = &amp;#34;&amp;#34;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;frontend_worker&#34;&gt;frontend_worker&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;frontend_worker&lt;/code&gt; configures the worker - running within the Loki querier - picking up and executing queries enqueued by the query-frontend.&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;# Address of query frontend service, in host:port format.
# CLI flag: -querier.frontend-address
[frontend_address: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Number of simultaneous queries to process.
# CLI flag: -querier.worker-parallelism
[parallelism: &amp;lt;int&amp;gt; | default = 10]

# Force worker concurrency to match the -querier.max-concurrent option. Overrides querier.worker-parallelism.
# CLI flag: -querier.worker-match-max-concurrent
[match_max_concurrent: &amp;lt;boolean&amp;gt; | default = true]

# How often to query the frontend_address DNS to resolve frontend addresses.
# Also used to determine how often to poll the scheduler-ring for addresses if configured.
# CLI flag: -querier.dns-lookup-period
[dns_lookup_duration: &amp;lt;duration&amp;gt; | default = 3s]

# The CLI flags prefix for this block config is: querier.frontend-client
[grpc_client_config: &amp;lt;grpc_client_config&amp;gt;]

# DNS hostname used for finding query-schedulers.
# CLI flag: -querier.scheduler-address
[scheduler_address: &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;ingester_client&#34;&gt;ingester_client&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;ingester_client&lt;/code&gt; block configures how connections to ingesters
operate.&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 how connections are pooled
pool_config:
  # Whether or not to do health checks.
  # CLI flag: -distributor.health-check-ingesters
  [health_check_ingesters: &amp;lt;boolean&amp;gt; | default = false]

  # How frequently to clean up clients for servers that have gone away after
  # a health check.
  # CLI flag: -distributor.client-cleanup-period
  [client_cleanup_period: &amp;lt;duration&amp;gt; | default = 15s]

  # How quickly a dead client will be removed after it has been detected
  # to disappear. Set this to a value to allow time for a secondary
  # health check to recover the missing client.
  # CLI flag: -ingester.client.healthcheck-timeout
  [remote_timeout: &amp;lt;duration&amp;gt; | default = 1s]

# The remote request timeout on the client side.
# CLI flag: -ingester.client.timeout
[remote_timeout: &amp;lt;duration&amp;gt; | default = 5s]

# Configures how the gRPC connection to ingesters work as a client
# The CLI flags prefix for this block config is: ingester.client
[grpc_client_config: &amp;lt;grpc_client_config&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;ingester&#34;&gt;ingester&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;ingester&lt;/code&gt; block configures the Loki Ingesters.&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 how the lifecycle of the ingester will operate
# and where it will register for discovery.
lifecycler:
  ring:
    kvstore:
      # Backend storage to use for the ring. Supported values are: consul, etcd,
      # inmemory, memberlist
      # CLI flag: -ring.store
      [store: &amp;lt;string&amp;gt; | default = &amp;#34;consul&amp;#34;]

      # The prefix for the keys in the store. Should end with a /.
      # CLI flag: -ring.prefix
      [prefix: &amp;lt;string&amp;gt; | default = &amp;#34;collectors/&amp;#34;]

      # The consul_config configures the consul client.
      # CLI flag: &amp;lt;no prefix&amp;gt;
      [consul: &amp;lt;consul_config&amp;gt;]

      # The etcd_config configures the etcd client.
      # CLI flag: &amp;lt;no prefix&amp;gt;
      [etcd: &amp;lt;etcd_config&amp;gt;]

    # The heartbeat timeout after which ingesters are skipped for reads/writes.
    # CLI flag: -ring.heartbeat-timeout
    [heartbeat_timeout: &amp;lt;duration&amp;gt; | default = 1m]

    # The number of ingesters to write to and read from.
    # CLI flag: -distributor.replication-factor
    [replication_factor: &amp;lt;int&amp;gt; | default = 3]

  # The number of tokens the lifecycler will generate and put into the ring if
  # it joined without transferring tokens from another lifecycler.
  # CLI flag: -ingester.num-tokens
  [num_tokens: &amp;lt;int&amp;gt; | default = 128]

  # Period at which to heartbeat to the underlying ring.
  # CLI flag: -ingester.heartbeat-period
  [heartbeat_period: &amp;lt;duration&amp;gt; | default = 5s]

  # How long to wait to claim tokens and chunks from another member when
  # that member is leaving. Will join automatically after the duration expires.
  # CLI flag: -ingester.join-after
  [join_after: &amp;lt;duration&amp;gt; | default = 0s]

  # Observe tokens after generating to resolve collisions. Useful when using a gossip ring.
  # CLI flag: -ingester.observe-period
  [observe_period: &amp;lt;duration&amp;gt; | default = 0s]

  # Minimum duration to wait before becoming ready. This is to work around race
  # conditions with ingesters exiting and updating the ring.
  # CLI flag: -ingester.min-ready-duration
  [min_ready_duration: &amp;lt;duration&amp;gt; | default = 15s]

  # Name of network interfaces to read addresses from.
  # CLI flag: -ingester.lifecycler.interface
  interface_names:

    - [&amp;lt;string&amp;gt; ... | default = [&amp;lt;private network interfaces&amp;gt;]]

  # Duration to sleep before exiting to ensure metrics are scraped.
  # CLI flag: -ingester.final-sleep
  [final_sleep: &amp;lt;duration&amp;gt; | default = 30s]

# Number of times to try and transfer chunks when leaving before
# falling back to flushing to the store. Zero = no transfers are done.
# CLI flag: -ingester.max-transfer-retries
[max_transfer_retries: &amp;lt;int&amp;gt; | default = 0]

# How many flushes can happen concurrently from each stream.
# CLI flag: -ingester.concurrent-flushes
[concurrent_flushes: &amp;lt;int&amp;gt; | default = 32]

# How often should the ingester see if there are any blocks to flush
# CLI flag: -ingester.flush-check-period
[flush_check_period: &amp;lt;duration&amp;gt; | default = 30s]

# The timeout before a flush is cancelled
# CLI flag: -ingester.flush-op-timeout
[flush_op_timeout: &amp;lt;duration&amp;gt; | default = 10m]

# How long chunks should be retained in-memory after they&amp;#39;ve been flushed.
# CLI flag: -ingester.chunks-retain-period
[chunk_retain_period: &amp;lt;duration&amp;gt; | default = 0s]

# How long chunks should sit in-memory with no updates before
# being flushed if they don&amp;#39;t hit the max block size. This means
# that half-empty chunks will still be flushed after a certain
# period as long as they receive no further activity.
# CLI flag: -ingester.chunks-idle-period
[chunk_idle_period: &amp;lt;duration&amp;gt; | default = 30m]

# The targeted _uncompressed_ size in bytes of a chunk block
# When this threshold is exceeded the head block will be cut and compressed inside the chunk.
# CLI flag: -ingester.chunks-block-size
[chunk_block_size: &amp;lt;int&amp;gt; | default = 262144]

# A target _compressed_ size in bytes for chunks.
# This is a desired size not an exact size, chunks may be slightly bigger
# or significantly smaller if they get flushed for other reasons (e.g. chunk_idle_period)
# A value of 0 creates chunks with a fixed 10 blocks,
# A non zero value will create chunks with a variable number of blocks to meet the target size.
# CLI flag: -ingester.chunk-target-size
[chunk_target_size: &amp;lt;int&amp;gt; | default = 1572864]

# The compression algorithm to use for chunks. (supported: gzip, lz4, snappy)
# You should choose your algorithm depending on your need:
# - `gzip` highest compression ratio but also slowest decompression speed. (144 kB per chunk)
# - `lz4` fastest compression speed (188 kB per chunk)
# - `snappy` fast and popular compression algorithm (272 kB per chunk)
# CLI flag: -ingester.chunk-encoding
[chunk_encoding: &amp;lt;string&amp;gt; | default = gzip]

# Parameters used to synchronize ingesters to cut chunks at the same moment.
# Sync period is used to roll over incoming entry to a new chunk. If chunk&amp;#39;s utilization
# isn&amp;#39;t high enough (eg. less than 50% when sync_min_utilization is set to 0.5), then
# this chunk rollover doesn&amp;#39;t happen.
# CLI flag: -ingester.sync-period
[sync_period: &amp;lt;duration&amp;gt; | default = 0]

# CLI flag: -ingester.sync-min-utilization
[sync_min_utilization: &amp;lt;float&amp;gt; | Default = 0]

# The maximum number of errors a stream will report to the user
# when a push fails. 0 to make unlimited.
# CLI flag: -ingester.max-ignored-stream-errors
[max_returned_stream_errors: &amp;lt;int&amp;gt; | default = 10]

# The maximum duration of a timeseries chunk in memory. If a timeseries runs for longer than this,
# the current chunk will be flushed to the store and a new chunk created.
# CLI flag: -ingester.max-chunk-age
[max_chunk_age: &amp;lt;duration&amp;gt; | default = 2h]

# How far in the past an ingester is allowed to query the store for data.
# This is only useful for running multiple Loki binaries with a shared ring
# with a `filesystem` store, which is NOT shared between the binaries.
# When using any &amp;#34;shared&amp;#34; object store like S3 or GCS, this value must always be left as 0.
# It is an error to configure this to a non-zero value when using any object store other
# than `filesystem`.
# Use a value of -1 to allow the ingester to query the store infinitely far back in time.
# CLI flag: -ingester.query-store-max-look-back-period
[query_store_max_look_back_period: &amp;lt;duration&amp;gt; | default = 0]

# Forget about ingesters having heartbeat timestamps older than `ring.kvstore.heartbeat_timeout`.
# This is equivalent to clicking on the `/ring` `forget` button in the UI:
# the ingester is removed from the ring.
# This is a useful setting when you are sure that an unhealthy node won&amp;#39;t return.
# An example is when not using stateful sets or the equivalent.
# Use `memberlist.rejoin_interval` &amp;gt; 0 to handle network partition cases when using a memberlist.
# CLI flag: -ingester.autoforget-unhealthy
[autoforget_unhealthy: &amp;lt;boolean&amp;gt; | default = false]

# The ingester WAL (Write Ahead Log) records incoming logs and stores them on
# the local file systems in order to guarantee persistence of acknowledged data
# in the event of a process crash.
wal:
  # Enables writing to WAL.
  # CLI flag: -ingester.wal-enabled
  [enabled: &amp;lt;boolean&amp;gt; | default = true]

  # Directory where the WAL data should be stored and/or recovered from.
  # CLI flag: -ingester.wal-dir
  [dir: &amp;lt;filename&amp;gt; | default = &amp;#34;wal&amp;#34;]

  # When WAL is enabled, should chunks be flushed to long-term storage on shutdown.
  # CLI flag: -ingester.flush-on-shutdown
  [flush_on_shutdown: &amp;lt;boolean&amp;gt; | default = false]

  # Interval at which checkpoints should be created.
  # CLI flag: ingester.checkpoint-duration
  [checkpoint_duration: &amp;lt;duration&amp;gt; | default = 5m]

  # Maximum memory size the WAL may use during replay. After hitting this,
  # it will flush data to storage before continuing.
  # A unit suffix (KB, MB, GB) may be applied.
  [replay_memory_ceiling: &amp;lt;string&amp;gt; | default = 4GB]

# Shard factor used in the ingesters for the in process reverse index.
# This MUST be evenly divisible by ALL schema shard factors or Loki will not start.
[index_shards: &amp;lt;int&amp;gt; | default = 32]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;consul_config&#34;&gt;consul_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;consul_config&lt;/code&gt; configures the consul client. The supported CLI flags &lt;prefix&gt; used to reference this config block are:&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; # The hostname and port of Consul.
# CLI flag: -&amp;lt;prefix&amp;gt;.consul.hostname
[host: &amp;lt;string&amp;gt; | default = &amp;#34;localhost:8500&amp;#34;]

# The ACL Token used to interact with Consul.
# CLI flag: -&amp;lt;prefix&amp;gt;.consul.acl-token
[acl_token: &amp;lt;string&amp;gt;]

# The HTTP timeout when communicating with Consul
# CLI flag: -&amp;lt;prefix&amp;gt;.consul.client-timeout
[http_client_timeout: &amp;lt;duration&amp;gt; | default = 20s]

# Whether or not consistent reads to Consul are enabled.
# CLI flag: -&amp;lt;prefix&amp;gt;.consul.consistent-reads
[consistent_reads: &amp;lt;boolean&amp;gt; | default = true]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;etcd_config&#34;&gt;etcd_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;etcd_config&lt;/code&gt; configures the etcd client. The supported CLI flags &lt;prefix&gt; used to reference this config block are:&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;# The etcd endpoints to connect to.
# CLI flag: -&amp;lt;prefix&amp;gt;.etcd.endpoints
[endpoints: &amp;lt;list of string&amp;gt; | default = []]

# The dial timeout for the etcd connection.
# CLI flag: -&amp;lt;prefix&amp;gt;.etcd.dial-timeout
[dial_timeout: &amp;lt;duration&amp;gt; | default = 10s]

# The maximum number of retries to do for failed ops.
# CLI flag: -&amp;lt;prefix&amp;gt;.etcd.max-retries
[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;memberlist_config&#34;&gt;memberlist_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;memberlist_config&lt;/code&gt; block configures the gossip ring to discover and connect
between distributors, ingesters and queriers. The configuration is unique for all
three components to ensure a single shared ring.&lt;/p&gt;
&lt;p&gt;When a &lt;code&gt;memberlist_config&lt;/code&gt; with least 1 &lt;code&gt;join_members&lt;/code&gt; is defined, a &lt;code&gt;kvstore&lt;/code&gt; of type &lt;code&gt;memberlist&lt;/code&gt; is
automatically configured for the &lt;code&gt;distributor&lt;/code&gt;, &lt;code&gt;ingester&lt;/code&gt;, and &lt;code&gt;ruler&lt;/code&gt; rings unless otherwise specified in
those components specific configuration sections.&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 node in memberlist cluster. Defaults to hostname.
# CLI flag: -memberlist.nodename
[node_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# Add random suffix to the node name.
# CLI flag: -memberlist.randomize-node-name
[randomize_node_name: &amp;lt;boolean&amp;gt; | default = true]

# The timeout for establishing a connection with a remote node, and for
# read/write operations. Uses memberlist LAN defaults if 0.
# CLI flag: -memberlist.stream-timeout
[stream_timeout: &amp;lt;duration&amp;gt; | default = 0s]

# Multiplication factor used when sending out messages (factor * log(N&amp;#43;1)).
# CLI flag: -memberlist.retransmit-factor
[retransmit_factor: &amp;lt;int&amp;gt; | default = 0]

# How often to use pull/push sync. Uses memberlist LAN defaults if 0.
# CLI flag: -memberlist.pullpush-interval
[pull_push_interval: &amp;lt;duration&amp;gt; | default = 0s]

# How often to gossip. Uses memberlist LAN defaults if 0.
# CLI flag: -memberlist.gossip-interval
[gossip_interval: &amp;lt;duration&amp;gt; | default = 0s]

# How many nodes to gossip to. Uses memberlist LAN defaults if 0.
# CLI flag: -memberlist.gossip-nodes
[gossip_nodes: &amp;lt;int&amp;gt; | default = 0]

# How long to keep gossiping to dead nodes, to give them chance to refute their
# death. Uses memberlist LAN defaults if 0.
# CLI flag: -memberlist.gossip-to-dead-nodes-time
[gossip_to_dead_nodes_time: &amp;lt;duration&amp;gt; | default = 0s]

# How soon can dead node&amp;#39;s name be reclaimed with new address. Defaults to 0,
# which is disabled.
# CLI flag: -memberlist.dead-node-reclaim-time
[dead_node_reclaim_time: &amp;lt;duration&amp;gt; | default = 0s]

# Other cluster members to join. Can be specified multiple times. It can be an
# IP, hostname or an entry specified in the DNS Service Discovery format (see
# https://grafana.com/docs/mimir/latest/operators-guide/configuring/about-dns-service-discovery/
# for more details).
# CLI flag: -memberlist.join
[join_members: &amp;lt;list of string&amp;gt; | default = ]

# Min backoff duration to join other cluster members.
# CLI flag: -memberlist.min-join-backoff
[min_join_backoff: &amp;lt;duration&amp;gt; | default = 1s]

# Max backoff duration to join other cluster members.
# CLI flag: -memberlist.max-join-backoff
[max_join_backoff: &amp;lt;duration&amp;gt; | default = 1m]

# Max number of retries to join other cluster members.
# CLI flag: -memberlist.max-join-retries
[max_join_retries: &amp;lt;int&amp;gt; | default = 10]

# If this node fails to join memberlist cluster, abort.
# CLI flag: -memberlist.abort-if-join-fails
[abort_if_cluster_join_fails: &amp;lt;boolean&amp;gt; | default = true]

# If not 0, how often to rejoin the cluster. Occasional rejoin can help to fix
# the cluster split issue, and is harmless otherwise. For example when using
# only few components as a seed nodes (via -memberlist.join), then it&amp;#39;s
# recommended to use rejoin. If -memberlist.join points to dynamic service that
# resolves to all gossiping nodes (eg. Kubernetes headless service), then rejoin
# is not needed.
# CLI flag: -memberlist.rejoin-interval
[rejoin_interval: &amp;lt;duration&amp;gt; | default = 0s]

# How long to keep LEFT ingesters in the ring.
# CLI flag: -memberlist.left-ingesters-timeout
[left_ingesters_timeout: &amp;lt;duration&amp;gt; | default = 5m]

# Timeout for leaving memberlist cluster.
# CLI flag: -memberlist.leave-timeout
[leave_timeout: &amp;lt;duration&amp;gt; | default = 5s]

# IP address to listen on for gossip messages. Multiple addresses may be
# specified. Defaults to 0.0.0.0
# CLI flag: -memberlist.bind-addr
[bind_addr: &amp;lt;list of string&amp;gt; | default = ]

# Port to listen on for gossip messages.
# CLI flag: -memberlist.bind-port
[bind_port: &amp;lt;int&amp;gt; | default = 7946]

# Timeout used when connecting to other nodes to send packet.
# CLI flag: -memberlist.packet-dial-timeout
[packet_dial_timeout: &amp;lt;duration&amp;gt; | default = 5s]

# Timeout for writing &amp;#39;packet&amp;#39; data.
# CLI flag: -memberlist.packet-write-timeout
[packet_write_timeout: &amp;lt;duration&amp;gt; | default = 5s]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;storage_config&#34;&gt;storage_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;storage_config&lt;/code&gt; block configures one of many possible stores for both the
index and chunks. Which configuration to be picked should be defined in schema_config
block.&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 storing chunks in AWS. Required options only required when aws is
# present.
aws:
  # S3 or S3-compatible endpoint URL with escaped Key and Secret encoded.
  # If only region is specified as a host, the proper endpoint will be deduced.
  # Use inmemory:///&amp;lt;bucket-name&amp;gt; to use a mock in-memory implementation.
  # CLI flag: -s3.url
  [s3: &amp;lt;string&amp;gt;]

  # Set to true to force the request to use path-style addressing
  # CLI flag: -s3.force-path-style
  [s3forcepathstyle: &amp;lt;boolean&amp;gt; | default = false]

  # Comma separated list of bucket names to evenly distribute chunks over.
  # Overrides any buckets specified in s3.url flag
  # CLI flag: -s3.buckets
  [bucketnames: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # S3 Endpoint to connect to.
  # CLI flag: -s3.endpoint
  [endpoint: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # AWS region to use.
  # CLI flag: -s3.region
  [region: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # AWS Access Key ID.
  # CLI flag: -s3.access-key-id
  [access_key_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # AWS Secret Access Key.
  # CLI flag: -s3.secret-access-key
  [secret_access_key: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Disable https on S3 connection.
  # CLI flag: -s3.insecure
  [insecure: &amp;lt;boolean&amp;gt; | default = false]

  # Enable AES256 AWS Server Side Encryption.
  # CLI flag: -s3.sse-encryption
  [sse_encryption: &amp;lt;boolean&amp;gt; | default = false]

  http_config:
    # The maximum amount of time an idle connection will be held open.
    # CLI flag: -s3.http.idle-conn-timeout
    [idle_conn_timeout: &amp;lt;duration&amp;gt; | default = 1m30s]

    # If non-zero, specifies the amount of time to wait for a server&amp;#39;s response
    # headers after fully writing the request.
    # CLI flag: -s3.http.response-header-timeout
    [response_header_timeout: &amp;lt;duration&amp;gt; | default = 0s]

    # Set to true to skip verifying the certificate chain and hostname.
    # CLI flag: -s3.http.insecure-skip-verify
    [insecure_skip_verify: &amp;lt;boolean&amp;gt; | default = false]

    # Path to the trusted CA file that signed the SSL certificate of the S3
    # endpoint.
    # CLI flag: -s3.http.ca-file
    [ca_file: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Configures back off when s3 get Object.
  backoff_config:
    # Minimum duration to back off.
    # CLI flag: -s3.backoff-min-period
    [min_period: &amp;lt;duration&amp;gt; | default = 100ms]

    # The duration to back off.
    # CLI flag: -s3.backoff-max-period
    [max_period: &amp;lt;duration&amp;gt; | default = 3s]

    # Number of times to back off and retry before failing.
    # CLI flag: -s3.backoff-retries
    [max_retries: &amp;lt;int&amp;gt; | default = 5]

  # Configure the DynamoDB connection
  dynamodb:
    # URL for DynamoDB with escaped Key and Secret encoded. If only region is specified as a
    # host, the proper endpoint will be deduced. Use inmemory:///&amp;lt;bucket-name&amp;gt; to
    # use a mock in-memory implementation.
    # CLI flag: -dynamodb.url
    dynamodb_url: &amp;lt;string&amp;gt;

    # DynamoDB table management requests per-second limit.
    # CLI flag: -dynamodb.api-limit
    [api_limit: &amp;lt;float&amp;gt; | default = 2.0]

    # DynamoDB rate cap to back off when throttled.
    # CLI flag: -dynamodb.throttle-limit
    [throttle_limit: &amp;lt;float&amp;gt; | default = 10.0]

    # Metrics-based autoscaling configuration.
    metrics:
      # Use metrics-based autoscaling via this Prometheus query URL.
      # CLI flag: -metrics.url
      [url: &amp;lt;string&amp;gt;]

      # Queue length above which we will scale up capacity.
      # CLI flag: -metrics.target-queue-length
      [target_queue_length: &amp;lt;int&amp;gt; | default = 100000]

      # Scale up capacity by this multiple
      # CLI flag: -metrics.scale-up-factor
      [scale_up_factor: &amp;lt;float64&amp;gt; | default = 1.3]

      # Ignore throttling below this level (rate per second)
      # CLI flag: -metrics.ignore-throttle-below
      [ignore_throttle_below: &amp;lt;float64&amp;gt; | default = 1]

    # Number of chunks to group together to parallelise fetches (0 to disable)
    # CLI flag: -dynamodb.chunk-gang-size
    [chunk_gang_size: &amp;lt;int&amp;gt; | default = 10]

    # Max number of chunk get operations to start in parallel.
    # CLI flag: -dynamodb.chunk.get-max-parallelism
    [chunk_get_max_parallelism: &amp;lt;int&amp;gt; | default = 32]

# Configures storing indexes in Bigtable. Required fields only required
# when bigtable is defined in config.
bigtable:
  # BigTable project ID
   # CLI flag: -bigtable.project
  project: &amp;lt;string&amp;gt;

  # BigTable instance ID
  # CLI flag: -bigtable.instance
  instance: &amp;lt;string&amp;gt;

  # Configures the gRPC client used to connect to Bigtable.
  # The CLI flags prefix for this block config is: bigtable
  [grpc_client_config: &amp;lt;grpc_client_config&amp;gt;]

# Configures storing chunks in GCS. Required fields only required
# when gcs is defined in config.
gcs:
  # Name of GCS bucket to put chunks in.
  # CLI flag: -gcs.bucketname
  bucket_name: &amp;lt;string&amp;gt;

  # The size of the buffer that the GCS client uses for each PUT request. 0
  # to disable buffering.
  # CLI flag: -gcs.chunk-buffer-size
  [chunk_buffer_size: &amp;lt;int&amp;gt; | default = 0]

  # The duration after which the requests to GCS should be timed out.
  # CLI flag: -gcs.request-timeout
  [request_timeout: &amp;lt;duration&amp;gt; | default = 0s]

# Configures storing chunks and/or the index in Cassandra
cassandra:
  # Comma-separated hostnames or IPs of Cassandra instances
  # CLI flag: -cassandra.addresses
  addresses: &amp;lt;string&amp;gt;

  # Port that cassandra is running on
  # CLI flag: -cassandra.port
  [port: &amp;lt;int&amp;gt; | default = 9042]

  # Keyspace to use in Cassandra
  # CLI flag: -cassandra.keyspace
  keyspace: &amp;lt;string&amp;gt;

  # Consistency level for Cassandra
  # CLI flag: -cassandra.consistency
  [consistency: &amp;lt;string&amp;gt; | default = &amp;#34;QUORUM&amp;#34;]

  # Replication factor to use in Cassandra.
  # CLI flag: -cassandra.replication-factor
  [replication_factor: &amp;lt;int&amp;gt; | default = 1]

  # Instruct the Cassandra driver to not attempt to get host
  # info from the system.peers table.
  # CLI flag: -cassandra.disable-initial-host-lookup
  [disable_initial_host_lookup: &amp;lt;boolean&amp;gt; | default = false]

  # Use SSL when connecting to Cassandra instances.
  # CLI flag: -cassandra.ssl
  [SSL: &amp;lt;boolean&amp;gt; | default = false]

  # Require SSL certificate validation when SSL is enabled.
  # CLI flag: -cassandra.host-verification
  [host_verification: &amp;lt;boolean&amp;gt; | default = true]

  # Path to CA certificate file to verify the peer when SSL is enabled.
  # CLI flag: -cassandra.ca-path
  [CA_path: &amp;lt;string&amp;gt;]

  # Path to client certificate file when SSL is enabled.
  # CLI flag: -cassandra.tls-cert-path
  [tls_cert_path: &amp;lt;string&amp;gt;]

  # Path to key certificate file when SSL is enabled.
  # CLI flag: -cassandra.tls-key-path
  [tls_key_path: &amp;lt;string&amp;gt;]

  # Enable password authentication when connecting to Cassandra.
  # CLI flag: -cassandra.auth
  [auth: &amp;lt;boolean&amp;gt; | default = false]

  # Username for password authentication when auth is true.
  # CLI flag: -cassandra.username
  [username: &amp;lt;string&amp;gt;]

  # Password for password authentication when auth is true.
  # CLI flag: -cassandra.password
  [password: &amp;lt;string&amp;gt;]

  # Timeout when connecting to Cassandra.
  # CLI flag: -cassandra.timeout
  [timeout: &amp;lt;duration&amp;gt; | default = 600ms]

  # Initial connection timeout during initial dial to server.
  # CLI flag: -cassandra.connect-timeout
  [connect_timeout: &amp;lt;duration&amp;gt; | default = 600ms]

swift:
  # Openstack authentication URL.
  # CLI flag: -ruler.storage.swift.auth-url
  [auth_url: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Openstack username for the api.
  # CLI flag: -ruler.storage.swift.username
  [username: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Openstack user&amp;#39;s domain name.
  # CLI flag: -ruler.storage.swift.user-domain-name
  [user_domain_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Openstack user&amp;#39;s domain id.
  # CLI flag: -ruler.storage.swift.user-domain-id
  [user_domain_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Openstack userid for the api.
  # CLI flag: -ruler.storage.swift.user-id
  [user_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Openstack api key.
  # CLI flag: -ruler.storage.swift.password
  [password: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Openstack user&amp;#39;s domain id.
  # CLI flag: -ruler.storage.swift.domain-id
  [domain_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Openstack user&amp;#39;s domain name.
  # CLI flag: -ruler.storage.swift.domain-name
  [domain_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Openstack project id (v2,v3 auth only).
  # CLI flag: -ruler.storage.swift.project-id
  [project_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Openstack project name (v2,v3 auth only).
  # CLI flag: -ruler.storage.swift.project-name
  [project_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Id of the project&amp;#39;s domain (v3 auth only), only needed if it differs the
  # from user domain.
  # CLI flag: -ruler.storage.swift.project-domain-id
  [project_domain_id: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Name of the project&amp;#39;s domain (v3 auth only), only needed if it differs
  # from the user domain.
  # CLI flag: -ruler.storage.swift.project-domain-name
  [project_domain_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Openstack Region to use eg LON, ORD - default is use first region (v2,v3
  # auth only)
  # CLI flag: -ruler.storage.swift.region-name
  [region_name: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Name of the Swift container to put chunks in.
  # CLI flag: -ruler.storage.swift.container-name
  [container_name: &amp;lt;string&amp;gt; | default = &amp;#34;cortex&amp;#34;]

# Configures storing index in BoltDB. Required fields only
# required when boltdb is present in the configuration.
boltdb:
  # Location of BoltDB index files.
  # CLI flag: -boltdb.dir
  directory: &amp;lt;string&amp;gt;

# Configures storing the chunks on the local file system. Required
# fields only required when filesystem is present in the configuration.
filesystem:
  # Directory to store chunks in.
  # CLI flag: -local.chunk-directory
  directory: &amp;lt;string&amp;gt;

# Configures storing index in an Object Store(GCS/S3/Azure/Swift/Filesystem) in the form of
# boltdb files.
# Required fields only required when boltdb-shipper is defined in config.
boltdb_shipper:
  # Directory where ingesters would write boltdb files which would then be
  # uploaded by shipper to configured storage
  # CLI flag: -boltdb.shipper.active-index-directory
  [active_index_directory: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Shared store for keeping boltdb files. Supported types: gcs, s3, azure,
  # filesystem
  # CLI flag: -boltdb.shipper.shared-store
  [shared_store: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Cache location for restoring boltDB files for queries
  # CLI flag: -boltdb.shipper.cache-location
  [cache_location: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # TTL for boltDB files restored in cache for queries
  # CLI flag: -boltdb.shipper.cache-ttl
  [cache_ttl: &amp;lt;duration&amp;gt; | default = 24h]

  # Resync downloaded files with the storage
  # CLI flag: -boltdb.shipper.resync-interval
  [resync_interval: &amp;lt;duration&amp;gt; | default = 5m]

  # Number of days of index to be kept downloaded for queries. Works only with
  # tables created with 24h period.
  # CLI flag: -boltdb.shipper.query-ready-num-days
  [query_ready_num_days: &amp;lt;int&amp;gt; | default = 0]

  index_gateway_client:
    # &amp;#34;Hostname or IP of the Index Gateway gRPC server.
    # CLI flag: -boltdb.shipper.index-gateway-client.server-address
    [server_address: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

    # Configures the gRPC client used to connect to the Index Gateway gRPC server.
    # The CLI flags prefix for this block config is: boltdb.shipper.index-gateway-client
    [grpc_client_config: &amp;lt;grpc_client_config&amp;gt;]

    # Configures if gateway requests should be logged or not.
    # CLI flag: -boltdb.shipper.index-gateway-client.log-gateway-requests
    [log_gateway_requests: &amp;lt;bool&amp;gt; | default = false]

# Cache validity for active index entries. Should be no higher than
# the chunk_idle_period in the ingester settings.
# CLI flag: -store.index-cache-validity
[index_cache_validity: &amp;lt;duration&amp;gt; | default = 5m]

# Disable broad index queries, which results in reduced cache usage and faster query
# performance at the expense of a somewhat higher QPS on the index store.
# CLI flag: -store.disable-broad-index-queries
[disable_broad_index_queries: &amp;lt;bool&amp;gt; | default = false]

# The maximum number of chunks to fetch per batch.
# CLI flag: -store.max-chunk-batch-size
[max_chunk_batch_size: &amp;lt;int&amp;gt; | default = 50]

# Config for how the cache for index queries should be built.
# The CLI flags prefix for this block config is: store.index-cache-read
index_queries_cache_config: &amp;lt;cache_config&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;chunk_store_config&#34;&gt;chunk_store_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;chunk_store_config&lt;/code&gt; block configures how chunks will be cached and how long
to wait before saving them to the backing store.&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;# The cache configuration for storing chunks
# The CLI flags prefix for this block config is: store.chunks-cache
[chunk_cache_config: &amp;lt;cache_config&amp;gt;]

# The cache configuration for deduplicating writes
# The CLI flags prefix for this block config is: store.index-cache-write
[write_dedupe_cache_config: &amp;lt;cache_config&amp;gt;]

# The minimum time between a chunk update and being saved
# to the store.
[min_chunk_age: &amp;lt;duration&amp;gt;]

# Cache index entries older than this period. Default is disabled.
# CLI flag: -store.cache-lookups-older-than
[cache_lookups_older_than: &amp;lt;duration&amp;gt;]

# Limit how long back data can be queried. Default is disabled.
# This should always be set to a value less than or equal to
# what is set in `table_manager.retention_period` .
# CLI flag: -store.max-look-back-period
[max_look_back_period: &amp;lt;duration&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;cache_config&#34;&gt;cache_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;cache_config&lt;/code&gt; block configures how Loki will cache requests, chunks, and
the index to a backing cache store.&lt;/p&gt;
&lt;p&gt;&lt;span style=&#34;background-color:#f3f973;&#34;&gt;The memcached configuration variable addresses is experimental.&lt;/span&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;# Enable in-memory cache.
# CLI flag: -&amp;lt;prefix&amp;gt;.cache.enable-fifocache
[enable_fifocache: &amp;lt;boolean&amp;gt;]

# The default validity of entries for caches unless overridden.
# NOTE In Loki versions older than 1.4.0 this was &amp;#34;defaul_validity&amp;#34;.
# CLI flag: -&amp;lt;prefix&amp;gt;.default-validity
[default_validity: &amp;lt;duration&amp;gt;]

# Configures the background cache when memcached is used.
background:
  # How many goroutines to use to write back to memcached.
  # CLI flag: -&amp;lt;prefix&amp;gt;.background.write-back-concurrency
  [writeback_goroutines: &amp;lt;int&amp;gt; | default = 10]

  # How many chunks to buffer for background write back to memcached.
  # CLI flagL -&amp;lt;prefix&amp;gt;.background.write-back-buffer
  [writeback_buffer: &amp;lt;int&amp;gt; = 10000]

# Configures memcached settings.
memcached:
  # Configures how long keys stay in memcached.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.expiration
  expiration: &amp;lt;duration&amp;gt;

  # Configures how many keys to fetch in each batch request.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.batchsize
  batch_size: &amp;lt;int&amp;gt; | default = 1024

  # Maximum active requests to memcached.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.parallelism
  [parallelism: &amp;lt;int&amp;gt; | default = 100]

# Configures how to connect to one or more memcached servers.
memcached_client:
  # The hostname to use for memcached services when caching chunks. If
  # empty, no memcached will be used. A SRV lookup will be used.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.hostname
  [host: &amp;lt;string&amp;gt;]

  # SRV service used to discover memcached servers.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.service
  [service: &amp;lt;string&amp;gt; | default = &amp;#34;memcached&amp;#34;]

  # (Experimental) Comma-separated addresses list in DNS Service Discovery format:
  # https://grafana.com/docs/mimir/latest/operators-guide/configuring/about-dns-service-discovery/
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.addresses
  [addresses: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

  # Maximum time to wait before giving up on memcached requests.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.timeout
  [timeout: &amp;lt;duration&amp;gt; | default = 100ms]

  # The maximum number of idle connections in the memcached client pool.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.max-idle-conns
  [max_idle_conns: &amp;lt;int&amp;gt; | default = 16]

  # The period with which to poll the DNS for memcached servers.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.update-interval
  [update_interval: &amp;lt;duration&amp;gt; | default = 1m]

  # Whether or not to use a consistent hash to discover multiple memcached servers.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.consistent-hash
  [consistent_hash: &amp;lt;boolean&amp;gt; | default = true]

  # Trip the circuit breaker after this number of consecutive dial failures.
  # A value of 0 disables the circuit breaker.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.circuit-breaker-consecutive-failures
  [circuit_breaker_consecutive_failures: &amp;lt;int&amp;gt; | default = 10]

  # Duration the circuit breaker remains open after tripping.
  # If set to 0, the duration is 60 seconds.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.circuit-breaker-timeout
  [circuit_breaker_timeout: &amp;lt;duration&amp;gt; | default = 10s]

  # Reset the circuit breaker counts after this duration.
  # A value of 0 never resets the circuit breaker.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.circuit-breaker-interval
  [circuit_breaker_interval: &amp;lt;duration&amp;gt; | default = 10s]

  # The maximum size of an item stored in memcached.
  # Bigger items are not stored. If set to 0, no maximum size is enforced.
  # CLI flag: -&amp;lt;prefix&amp;gt;.memcached.max-item-size
  [max_item_size: &amp;lt;int&amp;gt; | default = 0]

redis:
  # Redis Server or Cluster configuration endpoint to use for caching. A comma-separated list of endpoints
  # for Redis Cluster or Redis Sentinel. If empty, no redis will be used.
  # CLI flag: -&amp;lt;prefix&amp;gt;.redis.endpoint
  [endpoint: &amp;lt;string&amp;gt;]

  # Redis Sentinel master name. An empty string for Redis Server or Redis Cluster.
  # CLI flag: -&amp;lt;prefix&amp;gt;.redis.master-name
  [master_name: &amp;lt;string&amp;gt;]

  # Maximum time to wait before giving up on redis requests.
  # CLI flag: -&amp;lt;prefix&amp;gt;.redis.timeout
  [timeout: &amp;lt;duration&amp;gt; | default = 500ms]

  # How long keys stay in the redis.
  # CLI flag: -&amp;lt;prefix&amp;gt;.redis.expiration
  [expiration: &amp;lt;duration&amp;gt; | default = 0s]

  # Database index.
  # CLI flag: -&amp;lt;prefix&amp;gt;.redis.db
  [db: &amp;lt;int&amp;gt; | default = 0]

  # Maximum number of connections in the pool.
  # CLI flag: -&amp;lt;prefix&amp;gt;.redis.pool-size
  [pool_size: &amp;lt;int&amp;gt; | default = 0]

  # Password to use when connecting to redis.
  # CLI flag: -&amp;lt;prefix&amp;gt;.redis.password
  [password: &amp;lt;string&amp;gt;]

  # Enables connecting to redis with TLS.
  # CLI flag: -&amp;lt;prefix&amp;gt;.redis.tls-enabled
  [tls_enabled: &amp;lt;boolean&amp;gt; | default = false]

  # Skip validating server certificate.
  # CLI flag: -&amp;lt;prefix&amp;gt;.redis.tls-insecure-skip-verify
  [tls_insecure_skip_verify: &amp;lt;boolean&amp;gt; | default = false]

  # Close connections after remaining idle for this duration.
  # If the value is zero, then idle connections are not closed.
  # CLI flag: -&amp;lt;prefix&amp;gt;.redis.idle-timeout
  [idle_timeout: &amp;lt;duration&amp;gt; | default = 0s]

  # Close connections older than this duration. If the value is zero, then
  # the pool does not close connections based on age.
  # CLI flag: -&amp;lt;prefix&amp;gt;.redis.max-connection-age
  [max_connection_age: &amp;lt;duration&amp;gt; | default = 0s]

fifocache:
  # Maximum memory size of the cache in bytes. A unit suffix (KB, MB, GB) may be
  # applied.
  # CLI flag: -&amp;lt;prefix&amp;gt;.fifocache.max-size-bytes
  [max_size_bytes: &amp;lt;string&amp;gt; | default = &amp;#34;1GB&amp;#34;]

  # Maximum number of entries in the cache.
  # CLI flag: -&amp;lt;prefix&amp;gt;.fifocache.max-size-items
  [max_size_items: &amp;lt;int&amp;gt; | default = 0]

  # Deprecated: The expiry duration for the cache. Use `-&amp;lt;prefix&amp;gt;.fifocache.ttl`.
  # The default value of 0 disables expiration.
  # CLI flag: -&amp;lt;prefix&amp;gt;.fifocache.duration
  [validity: &amp;lt;duration&amp;gt;]

  # The time for items to live in the cache before those items are purged.
  # The value of 0 disables auto-expiration.
  # CLI flag: -&amp;lt;prefix&amp;gt;.fifocache.ttl
  [ttl: &amp;lt;duration&amp;gt; | default = 1h]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;schema_config&#34;&gt;schema_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;schema_config&lt;/code&gt; block configures schemas from given dates.&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;# The configuration for chunk index schemas.
configs:
- [&amp;lt;period_config&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;period_config&#34;&gt;period_config&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;period_config&lt;/code&gt; block configures what index schemas should be used
for from specific time periods.&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;# The date of the first day that index buckets should be created. Use
# a date in the past if this is your only period_config, otherwise
# use a date when you want the schema to switch over.
# In YYYY-MM-DD format, for example: 2018-04-15.
[from: &amp;lt;daytime&amp;gt;]

# store and object_store below affect which &amp;lt;storage_config&amp;gt; key is
# used.

# Which store to use for the index. Either aws, aws-dynamo, gcp, bigtable, bigtable-hashed,
# cassandra, boltdb or boltdb-shipper.
store: &amp;lt;string&amp;gt;

# Which store to use for the chunks. Either aws, azure, gcp,
# bigtable, gcs, cassandra, swift or filesystem. If omitted, defaults to the same
# value as store.
[object_store: &amp;lt;string&amp;gt;]

# The schema version to use, current recommended schema is v11.
schema: &amp;lt;string&amp;gt;

# Configures how the index is updated and stored.
index:
  # Table prefix for all period tables.
  prefix: &amp;lt;string&amp;gt;
  # Table period.
  [period: &amp;lt;duration&amp;gt; | default = 168h]
  # A map to be added to all managed tables.
  tags:
    [&amp;lt;string&amp;gt;: &amp;lt;string&amp;gt; ...]

# Configured how the chunks are updated and stored.
chunks:
  # Table prefix for all period tables.
  prefix: &amp;lt;string&amp;gt;
  # Table period.
  [period: &amp;lt;duration&amp;gt; | default = 168h]
  # A map to be added to all managed tables.
  tags:
    [&amp;lt;string&amp;gt;: &amp;lt;string&amp;gt; ...]

# How many shards will be created. Only used if schema is v10 or greater.
[row_shards: &amp;lt;int&amp;gt; | default = 16]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;compactor&#34;&gt;compactor&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;compactor&lt;/code&gt; block configures the compactor component. This component periodically
compacts index shards to more performant forms.&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 where files can be downloaded for compaction.
# CLI flag: -boltdb.shipper.compactor.working-directory
[working_directory: &amp;lt;string&amp;gt;]

# The shared store used for storing boltdb files.
# Supported types: gcs, s3, azure, swift, filesystem, bos.
# CLI flag: -boltdb.shipper.compactor.shared-store
[shared_store: &amp;lt;string&amp;gt;]

# Prefix to add to object keys in shared store.
# Path separator(if any) should always be a &amp;#39;/&amp;#39;.
# Prefix should never start with a separator but should always end with it.
# CLI flag: -boltdb.shipper.compactor.shared-store.key-prefix
[shared_store_key_prefix: &amp;lt;string&amp;gt; | default = &amp;#34;index/&amp;#34;]

# Interval at which to re-run the compaction operation (or retention if enabled).
# CLI flag: -boltdb.shipper.compactor.compaction-interval
[compaction_interval: &amp;lt;duration&amp;gt; | default = 10m]

# (Experimental) Activate custom (per-stream,per-tenant) retention.
# CLI flag: -boltdb.shipper.compactor.retention-enabled
[retention_enabled: &amp;lt;boolean&amp;gt; | default = false]

# Delay after which chunks will be fully deleted during retention.
# CLI flag: -boltdb.shipper.compactor.retention-delete-delay
[retention_delete_delay: &amp;lt;duration&amp;gt; | default = 2h]

# The total amount of worker to use to delete chunks.
# CLI flag: -boltdb.shipper.compactor.retention-delete-worker-count
[retention_delete_worker_count: &amp;lt;int&amp;gt; | default = 150]

# Allow cancellation of delete request until duration after they are created.
# Data would be deleted only after delete requests have been older than this duration.
# Ideally this should be set to at least 24h.
# CLI flag: -boltdb.shipper.compactor.delete-request-cancel-period
[delete_request_cancel_period: &amp;lt;duration&amp;gt; | default = 24h]

# Which deletion mode to use. Supported values are: disabled,
# whole-stream-deletion, filter-only, and filter-and-delete.
# CLI flag: -boltdb.shipper.compactor.deletion-mode
[deletion_mode: &amp;lt;string&amp;gt; | default = &amp;#34;whole-stream-deletion&amp;#34;]

# Maximum number of tables to compact in parallel.
# While increasing this value, please make sure compactor has enough disk space
# allocated to be able to store and compact as many tables.
# CLI flag: -boltdb.shipper.compactor.max-compaction-parallelism
[max_compaction_parallelism: &amp;lt;int&amp;gt; | default = 1]

# Deletion mode.
# Can be one of &amp;#34;disabled&amp;#34;, &amp;#34;filter-only&amp;#34;, or &amp;#34;filter-and-delete&amp;#34;.
# When set to &amp;#34;filter-only&amp;#34; or &amp;#34;filter-and-delete&amp;#34;, and if
# retention_enabled is true, then the log entry deletion API endpoints are available.
# CLI flag: -boltdb.shipper.compactor.deletion-mode
[deletion_mode: &amp;lt;string&amp;gt; | default = &amp;#34;disabled&amp;#34;]

# The hash ring configuration used by compactors to elect a single instance for running compactions
# The CLI flags prefix for this block config is: boltdb.shipper.compactor.ring
[compactor_ring: &amp;lt;ring&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;limits_config&#34;&gt;limits_config&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;limits_config&lt;/code&gt; block configures global and per-tenant limits in Loki.&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 the ingestion rate limit should be applied individually to each
# distributor instance (local), or evenly shared across the cluster (global).
# The ingestion rate strategy cannot be overridden on a per-tenant basis.
#
# - local: enforces the limit on a per distributor basis. The actual effective
#   rate limit will be N times higher, where N is the number of distributor
#   replicas.
# - global: enforces the limit globally, configuring a per-distributor local
#   rate limiter as &amp;#34;ingestion_rate / N&amp;#34;, where N is the number of distributor
#   replicas (it&amp;#39;s automatically adjusted if the number of replicas change).
#   The global strategy requires the distributors to form their own ring, which
#   is used to keep track of the current number of healthy distributor replicas.
# CLI flag: -distributor.ingestion-rate-limit-strategy
[ingestion_rate_strategy: &amp;lt;string&amp;gt; | default = &amp;#34;global&amp;#34;]

# Per-user ingestion rate limit in sample size per second. Units in MB.
# CLI flag: -distributor.ingestion-rate-limit-mb
[ingestion_rate_mb: &amp;lt;float&amp;gt; | default = 4]

# Per-user allowed ingestion burst size (in sample size). Units in MB.
# The burst size refers to the per-distributor local rate limiter even in the
# case of the &amp;#34;global&amp;#34; strategy, and should be set at least to the maximum logs
# size expected in a single push request.
# CLI flag: -distributor.ingestion-burst-size-mb
[ingestion_burst_size_mb: &amp;lt;int&amp;gt; | default = 6]

# Maximum length of a label name.
# CLI flag: -validation.max-length-label-name
[max_label_name_length: &amp;lt;int&amp;gt; | default = 1024]

# Maximum length of a label value.
# CLI flag: -validation.max-length-label-value
[max_label_value_length: &amp;lt;int&amp;gt; | default = 2048]

# Maximum number of label names per series.
# CLI flag: -validation.max-label-names-per-series
[max_label_names_per_series: &amp;lt;int&amp;gt; | default = 30]

# Whether or not old samples will be rejected.
# CLI flag: -validation.reject-old-samples
[reject_old_samples: &amp;lt;boolean&amp;gt; | default = true]

# Maximum accepted sample age before rejecting.
# CLI flag: -validation.reject-old-samples.max-age
[reject_old_samples_max_age: &amp;lt;duration&amp;gt; | default = 168h]

# Duration for a table to be created/deleted before/after it&amp;#39;s
# needed. Samples won&amp;#39;t be accepted before this time.
# CLI flag: -validation.create-grace-period
[creation_grace_period: &amp;lt;duration&amp;gt; | default = 10m]

# Enforce every sample has a metric name.
# CLI flag: -validation.enforce-metric-name
[enforce_metric_name: &amp;lt;boolean&amp;gt; | default = true]

# Maximum line size on ingestion path. Example: 256kb.
# There is no limit when unset or set to 0.
# CLI flag: -distributor.max-line-size
[max_line_size: &amp;lt;string&amp;gt; | default = 0 ]

# Truncate log lines when they exceed max_line_size.
# CLI flag: -distributor.max-line-size-truncate
[max_line_size_truncate: &amp;lt;boolean&amp;gt; | default = false ]

# Alter the log line timestamp during ingestion when the timestamp is the same as the
# previous entry for the same stream. When enabled, if a log line in a push request has
# the same timestamp as the previous line for the same stream, one nanosecond is added
# to the log line. This will preserve the received order of log lines with the exact
# same timestamp when they are queried, by slightly altering their stored timestamp.
# NOTE: This is imperfect, because Loki accepts out of order writes, and another push
# request for the same stream could contain duplicate timestamps to existing
# entries and they will not be incremented.
# CLI flag: -validation.increment-duplicate-timestamps
[increment_duplicate_timestamp: &amp;lt;boolean&amp;gt; | default = false ]

# Maximum number of log entries that will be returned for a query.
# CLI flag: -validation.max-entries-limit
[max_entries_limit_per_query: &amp;lt;int&amp;gt; | default = 5000 ]

# Maximum number of active streams per user, per ingester. 0 to make it unlimited.
# CLI flag: -ingester.max-streams-per-user
[max_streams_per_user: &amp;lt;int&amp;gt; | default 0]

# Maximum number of active streams per user, across the cluster. 0 to disable.
# When the global limit is enabled, each ingester is configured with a dynamic
# local limit based on the replication factor and the current number of healthy
# ingesters, and is kept updated whenever the number of ingesters change.
# CLI flag: -ingester.max-global-streams-per-user
[max_global_streams_per_user: &amp;lt;int&amp;gt; | default = 5000]

# When true, out-of-order writes are accepted.
# CLI flag: -ingester.unordered-writes
[unordered_writes: &amp;lt;boolean&amp;gt; | default = true]

# Maximum number of chunks that can be fetched by a single query.
# CLI flag: -store.query-chunk-limit
[max_chunks_per_query: &amp;lt;int&amp;gt; | default = 2000000]

# The limit to length of chunk store queries. 0 to disable.
# CLI flag: -store.max-query-length
[max_query_length: &amp;lt;duration&amp;gt; | default = 721h]

# Maximum number of queries that will be scheduled in parallel by the frontend.
# CLI flag: -querier.max-query-parallelism
[max_query_parallelism: &amp;lt;int&amp;gt; | default = 32]

# Limit the maximum of unique series that is returned by a metric query.
# When the limit is reached an error is returned.
# CLI flag: -querier.max-query-series
[max_query_series: &amp;lt;int&amp;gt; | default = 500]

# Cardinality limit for index queries.
# CLI flag: -store.cardinality-limit
[cardinality_limit: &amp;lt;int&amp;gt; | default = 100000]

# Maximum number of stream matchers per query.
# CLI flag: -querier.max-streams-matcher-per-query
[max_streams_matchers_per_query: &amp;lt;int&amp;gt; | default = 1000]

# Maximum number of concurrent tail requests.
# CLI flag: -querier.max-concurrent-tail-requests
[max_concurrent_tail_requests: &amp;lt;int&amp;gt; | default = 10]

# Duration to delay the evaluation of rules to ensure.
# CLI flag: -ruler.evaluation-delay-duration
[ruler_evaluation_delay_duration: &amp;lt;duration&amp;gt; | default = 0s]

# Maximum number of rules per rule group per-tenant. 0 to disable.
# CLI flag: -ruler.max-rules-per-rule-group
[ruler_max_rules_per_rule_group: &amp;lt;int&amp;gt; | default = 0]

# Maximum number of rule groups per-tenant. 0 to disable.
# CLI flag: -ruler.max-rule-groups-per-tenant
[ruler_max_rule_groups_per_tenant: &amp;lt;int&amp;gt; | default = 0]

# Retention to apply for the store, if the retention is enable on the compactor side.
# CLI flag: -store.retention
[retention_period: &amp;lt;duration&amp;gt; | default = 744h]

# Per-stream retention to apply, if the retention is enable on the compactor side.
# Example:
# retention_stream:
# - selector: &amp;#39;{namespace=&amp;#34;dev&amp;#34;}&amp;#39;
#   priority: 1
#   period: 24h
# - selector: &amp;#39;{container=&amp;#34;nginx&amp;#34;}&amp;#39;
#   priority: 1
#   period: 744h
# Selector is a Prometheus labels matchers that will apply the `period` retention only if
# the stream is matching. In case multiple stream are matching, the highest
# priority will be picked. If no rule is matched the `retention_period` is used.
[retention_stream: &amp;lt;array&amp;gt; | default = none]

# Feature renamed to &amp;#39;runtime configuration&amp;#39;, flag deprecated in favor of -runtime-config.file
# (runtime_config.file in YAML).
# CLI flag: -limits.per-user-override-config
[per_tenant_override_config: &amp;lt;string&amp;gt;]

# Feature renamed to &amp;#39;runtime configuration&amp;#39;; flag deprecated in favor of
# -runtime-config.reload-period (runtime_config.period in YAML).
# CLI flag: -limits.per-user-override-period
[per_tenant_override_period: &amp;lt;duration&amp;gt; | default = 10s]

# Most recent allowed cacheable result per-tenant, to prevent caching very recent results that
# might still be in flux.
# CLI flag: -frontend.max-cache-freshness
[max_cache_freshness_per_query: &amp;lt;duration&amp;gt; | default = 1m]

# Maximum number of queriers that can handle requests for a single tenant. If
# set to 0 or value higher than number of available queriers, *all* queriers
# will handle requests for the tenant. Each frontend (or query-scheduler, if
# used) will select the same set of queriers for the same tenant (given that all
# queriers are connected to all frontends / query-schedulers). This option only
# works with queriers connecting to the query-frontend / query-scheduler, not
# when using downstream URL.
# CLI flag: -frontend.max-queriers-per-tenant
[max_queriers_per_tenant: &amp;lt;int&amp;gt; | default = 0]

# Maximum byte rate per second per stream,
# also expressible in human readable forms (1MB, 256KB, etc).
# CLI flag: -ingester.per-stream-rate-limit
[per_stream_rate_limit: &amp;lt;string|int&amp;gt; | default = &amp;#34;3MB&amp;#34;]

# Maximum burst bytes per stream,
# also expressible in human readable forms (1MB, 256KB, etc).
# This is how far above the rate limit a stream can &amp;#34;burst&amp;#34; before the stream is limited.
# CLI flag: -ingester.per-stream-rate-limit-burst
[per_stream_rate_limit_burst: &amp;lt;string|int&amp;gt; | default = &amp;#34;15MB&amp;#34;]

# Limit how far back in time series data and metadata can be queried,
# up until lookback duration ago.
# This limit is enforced in the query frontend, the querier and the ruler.
# If the requested time range is outside the allowed range, the request will not fail,
# but will be modified to only query data within the allowed time range.
# The default value of 0 does not set a limit.
# CLI flag: -querier.max-query-lookback
[max_query_lookback: &amp;lt;duration&amp;gt; | default = 0]

# Disable recording rules remote-write.
[ruler_remote_write_disabled: &amp;lt;boolean&amp;gt; | default = false]

# The URL of the endpoint to send samples to.
[ruler_remote_write_url: &amp;lt;string&amp;gt;]

# Timeout for requests to the remote write endpoint.
[ruler_remote_write_timeout: &amp;lt;duration&amp;gt;]

# Custom HTTP headers to be sent along with each remote write request.
# Be aware that headers that are set by Loki itself can&amp;#39;t be overwritten.
[ruler_remote_write_headers: &amp;lt;headers&amp;gt;]

# List of remote write relabel configurations.
[ruler_remote_write_relabel_configs: &amp;lt;relabel_config&amp;gt;]

# Number of samples to buffer per shard before we block reading of more
# samples from the WAL. It is recommended to have enough capacity in each
# shard to buffer several requests to keep throughput up while processing
# occasional slow remote requests.
[ruler_remote_write_queue_capacity: &amp;lt;int&amp;gt;]

# Minimum number of shards, i.e. amount of concurrency.
[ruler_remote_write_queue_min_shards: &amp;lt;int&amp;gt;]

# Maximum number of shards, i.e. amount of concurrency.
[ruler_remote_write_queue_max_shards: &amp;lt;int&amp;gt;]

# Maximum number of samples per send.
[ruler_remote_write_queue_max_samples_per_send: &amp;lt;int&amp;gt;]

# Maximum time a sample will wait in buffer.
[ruler_remote_write_queue_batch_send_deadline: &amp;lt;duration&amp;gt;]

# Initial retry delay. Gets doubled for every retry.
[ruler_remote_write_queue_min_backoff: &amp;lt;duration&amp;gt;]

# Maximum retry delay.
[ruler_remote_write_queue_max_backoff: &amp;lt;duration&amp;gt;]
# Retry upon receiving a 429 status code from the remote-write storage.
# This is experimental and might change in the future.
[ruler_remote_write_queue_retry_on_ratelimit: &amp;lt;boolean&amp;gt;]

# Limit queries that can be sharded.
# Queries within the time range of now and now minus this sharding lookback
# are not sharded. The default value of 0s disables the lookback, causing
# sharding of all queries at all times.
# CLI flag: -frontend.min-sharding-lookback
[min_sharding_lookback: &amp;lt;duration&amp;gt; | default = 0s]

# Split queries by an interval and execute in parallel, any value less than zero disables it.
# This also determines how cache keys are chosen when result caching is enabled
# CLI flag: -querier.split-queries-by-interval
[split_queries_by_interval: &amp;lt;duration&amp;gt; | default = 30m]

# When true, access to the deletion API is enabled.
# CLI flag: -compactor.allow_deletes
[allow_deletes: &amp;lt;boolean&amp;gt; | default = false]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;grpc_client_config&#34;&gt;grpc_client_config&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;grpc_client_config&lt;/code&gt; block configures a client connection to a gRPC service.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;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;# The maximum size in bytes the client can receive.
# CLI flag: -&amp;lt;prefix&amp;gt;.grpc-max-recv-msg-size
[max_recv_msg_size: &amp;lt;int&amp;gt; | default = 104857600]

# The maximum size in bytes the client can send.
# CLI flag: -&amp;lt;prefix&amp;gt;.grpc-max-send-msg-size
[max_send_msg_size: &amp;lt;int&amp;gt; | default = 16777216]

# Use compression when sending messages. Supported values are: &amp;#39;gzip&amp;#39;, &amp;#39;snappy&amp;#39;,
# and &amp;#39;&amp;#39; (disable compression).
# CLI flag: -&amp;lt;prefix&amp;gt;.grpc-compression
[grpc_compression: &amp;lt;string&amp;gt; | default = &amp;#39;&amp;#39;]

# Rate limit for gRPC client. 0 is disabled.
# CLI flag: -&amp;lt;prefix&amp;gt;.grpc-client-rate-limit
[rate_limit: &amp;lt;float&amp;gt; | default = 0]

# Rate limit burst for gRPC client.
# CLI flag: -&amp;lt;prefix&amp;gt;.grpc-client-rate-limit-burst
[rate_limit_burst: &amp;lt;int&amp;gt; | default = 0]

# Enable backoff and retry when a rate limit is hit.
# CLI flag: -&amp;lt;prefix&amp;gt;.backoff-on-ratelimits
[backoff_on_ratelimits: &amp;lt;boolean&amp;gt; | default = false]

# Configures backoff when enabled.
backoff_config:
  # Minimum delay when backing off.
  # CLI flag: -&amp;lt;prefix&amp;gt;.backoff-min-period
  [min_period: &amp;lt;duration&amp;gt; | default = 100ms]

  # The maximum delay when backing off.
  # CLI flag: -&amp;lt;prefix&amp;gt;.backoff-max-period
  [max_period: &amp;lt;duration&amp;gt; | default = 10s]

  # Number of times to backoff and retry before failing.
  # CLI flag: -&amp;lt;prefix&amp;gt;.backoff-retries
  [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;index_gateway&#34;&gt;index_gateway&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;index_gateway&lt;/code&gt; block configures the Loki index gateway server, responsible for serving index queries
without the need to constantly interact with the object store.&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;# Defines in which mode the index gateway server will operate (default to &amp;#39;simple&amp;#39;).
# It supports two modes:
# &amp;#39;simple&amp;#39;: an index gateway server instance is responsible for handling,
#     storing and returning requests for all indices for all tenants.
# &amp;#39;ring&amp;#39;: an index gateway server instance is responsible for a subset of tenants instead
#     of all tenants.
[mode: &amp;lt;string&amp;gt; | default = simple]

# Defines the ring to be used by the index gateway servers and clients in case the servers
# are configured to run in &amp;#39;ring&amp;#39; mode. In case this isn&amp;#39;t configured, this block supports
# inheriting configuration from the common ring section.
[ring: &amp;lt;ring&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;table_manager&#34;&gt;table_manager&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;table_manager&lt;/code&gt; block configures the Loki table-manager.&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;# Master &amp;#39;off-switch&amp;#39; for table capacity updates, e.g. when troubleshooting.
# CLI flag: -table-manager.throughput-updates-disabled
[throughput_updates_disabled: &amp;lt;boolean&amp;gt; | default = false]

# Master &amp;#39;on-switch&amp;#39; for table retention deletions.
# CLI flag: -table-manager.retention-deletes-enabled
[retention_deletes_enabled: &amp;lt;boolean&amp;gt; | default = false]

# How far back tables will be kept before they are deleted. 0s disables
# deletion. The retention period must be a multiple of the index / chunks
# table &amp;#34;period&amp;#34; (see period_config).
# CLI flag: -table-manager.retention-period
[retention_period: &amp;lt;duration&amp;gt; | default = 0s]

# Period with which the table manager will poll for tables.
# CLI flag: -table-manager.poll-interval
[poll_interval: &amp;lt;duration&amp;gt; | default = 2m]

# Duration a table will be created before it is needed.
# CLI flag: -table-manager.periodic-table.grace-period
[creation_grace_period: &amp;lt;duration&amp;gt; | default = 10m]

# Configures management of the index tables for DynamoDB.
# The CLI flags prefix for this block config is: table-manager.index-table
index_tables_provisioning: &amp;lt;provision_config&amp;gt;

# Configures management of the chunk tables for DynamoDB.
# The CLI flags prefix for this block config is: table-manager.chunk-table
chunk_tables_provisioning: &amp;lt;provision_config&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;provision_config&#34;&gt;provision_config&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;provision_config&lt;/code&gt; block configures provisioning capacity for DynamoDB.&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;# Enables on-demand throughput provisioning for the storage
# provider, if supported. Applies only to tables which are not autoscaled.
# CLI flag: -&amp;lt;prefix&amp;gt;.enable-ondemand-throughput-mode
[enable_ondemand_throughput_mode: &amp;lt;boolean&amp;gt; | default = false]

# DynamoDB table default write throughput.
# CLI flag: -&amp;lt;prefix&amp;gt;.write-throughput
[provisioned_write_throughput: &amp;lt;int&amp;gt; | default = 3000]

# DynamoDB table default read throughput.
# CLI flag: -&amp;lt;prefix&amp;gt;.read-throughput
[provisioned_read_throughput: &amp;lt;int&amp;gt; | default = 300]

# Enables on-demand throughput provisioning for the storage provide,
# if supported. Applies only to tables which are not autoscaled.
# CLI flag: -&amp;lt;prefix&amp;gt;.inactive-enable-ondemand-throughput-mode
[enable_inactive_throughput_on_demand_mode: &amp;lt;boolean&amp;gt; | default = false]

# DynamoDB table write throughput for inactive tables.
# CLI flag: -&amp;lt;prefix&amp;gt;.inactive-write-throughput
[inactive_write_throughput: &amp;lt;int&amp;gt; | default = 1]

# DynamoDB table read throughput for inactive tables.
# CLI flag: -&amp;lt;prefix&amp;gt;.inactive-read-throughput
[inactive_read_throughput: &amp;lt;int&amp;gt; | default = 300]

# Active table write autoscale config.
# The CLI flags prefix for this block config is: -&amp;lt;prefix&amp;gt;.write-throughput
[write_scale: &amp;lt;auto_scaling_config&amp;gt;]

# Inactive table write autoscale config.
# The CLI flags prefix for this block config is: -&amp;lt;prefix&amp;gt;.inactive-write-throughput
[inactive_write_scale: &amp;lt;auto_scaling_config&amp;gt;]

# Number of last inactive tables to enable write autoscale.
# CLI flag: -&amp;lt;prefix&amp;gt;.enable-ondemand-throughput-mode
[inactive_write_scale_lastn: &amp;lt;int&amp;gt;]

# Active table read autoscale config.
# The CLI flags prefix for this block config is: -&amp;lt;prefix&amp;gt;.read-throughput
[read_scale: &amp;lt;auto_scaling_config&amp;gt;]

# Inactive table read autoscale config.
# The CLI flags prefix for this block config is: -&amp;lt;prefix&amp;gt;.inactive-read-throughput
[inactive_read_scale: &amp;lt;auto_scaling_config&amp;gt;]

# Number of last inactive tables to enable read autoscale.
# CLI flag: -&amp;lt;prefix&amp;gt;.enable-ondemand-throughput-mode
[inactive_read_scale_lastn: &amp;lt;int&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;auto_scaling_config&#34;&gt;auto_scaling_config&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;auto_scaling_config&lt;/code&gt; block configures autoscaling for DynamoDB.&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 or not autoscaling should be enabled.
# CLI flag: -&amp;lt;prefix&amp;gt;.scale.enabled
[enabled: &amp;lt;boolean&amp;gt;: default = false]

# AWS AutoScaling role ARN.
# CLI flag: -&amp;lt;prefix&amp;gt;.scale.role-arn
[role_arn: &amp;lt;string&amp;gt;]

# DynamoDB minimum provision capacity.
# CLI flag: -&amp;lt;prefix&amp;gt;.scale.min-capacity
[min_capacity: &amp;lt;int&amp;gt; | default = 3000]

# DynamoDB maximum provision capacity.
# CLI flag: -&amp;lt;prefix&amp;gt;.scale.max-capacity
[max_capacity: &amp;lt;int&amp;gt; | default = 6000]

# DynamoDB minimum seconds between each autoscale up.
# CLI flag: -&amp;lt;prefix&amp;gt;.scale.out-cooldown
[out_cooldown: &amp;lt;int&amp;gt; | default = 1800]

# DynamoDB minimum seconds between each autoscale down.
# CLI flag: -&amp;lt;prefix&amp;gt;.scale.in-cooldown
[in_cooldown: &amp;lt;int&amp;gt; | default = 1800]

# DynamoDB target ratio of consumed capacity to provisioned capacity.
# CLI flag: -&amp;lt;prefix&amp;gt;.scale.target-value
[target: &amp;lt;float&amp;gt; | default = 80]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;tracing&#34;&gt;tracing&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;tracing&lt;/code&gt; block configures tracing for Jaeger. Currently limited to disable auto-configuration per &lt;a href=&#34;https://www.jaegertracing.io/docs/1.16/client-features/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;environment variables&lt;/a&gt; only.&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 or not tracing should be enabled.
# CLI flag: -tracing.enabled
[enabled: &amp;lt;boolean&amp;gt;: default = true]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;common&#34;&gt;common&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;common&lt;/code&gt; block sets common definitions to be shared by different components.
This way, one doesn&amp;rsquo;t have to replicate configuration in multiple places.&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;# A common storage configuration to be used by the different Loki components.
[storage: &amp;lt;storage&amp;gt;]

# When defined, the given prefix will be present in front of the endpoint paths.
[path_prefix: &amp;lt;string&amp;gt;]

# How many times incoming data should be replicated to the ingester component.
[replication_factor: &amp;lt;int&amp;gt; | default = 3]

# When true, the ingester, compactor, and query_scheduler ring tokens will be saved
# to files in the path_prefix directory. Loki will error if you set this to true
# and path_prefix is empty.
[persist_tokens: &amp;lt;boolean&amp;gt;: default = false]

# A common list of net interfaces used internally to look for addresses.
# If a more specific &amp;#34;instance_interface_names&amp;#34; is set, this is ignored.
# If &amp;#34;instance_interface_names&amp;#34; under the common ring section is configured,
# this common &amp;#34;instance_interface_names&amp;#34; is only applied to the frontend, but not for
# ring related components (ex: distributor, ruler, etc).
[instance_interface_names: &amp;lt;list of string&amp;gt; | default = [&amp;lt;private network interfaces&amp;gt;]]

# A common address used by Loki components to advertise their address.
# If a more specific &amp;#34;instance_addr&amp;#34; is set, this is ignored.
# If &amp;#34;instance_addr&amp;#34; under the common ring section is configured, this common &amp;#34;instance_addr&amp;#34;
# is only applied to the frontend, but not for ring related components (ex: distributor, ruler, etc).
[instance_addr: &amp;lt;string&amp;gt;]

# A common ring configuration to be used by all Loki rings.
# If a common ring is given, its values are used to define any undefined ring values.
# For instance, you can expect the `heartbeat_period` defined in the common section
# to be used by the distributor&amp;#39;s ring, but only if the distributor&amp;#39;s ring itself
# doesn&amp;#39;t have a `heartbeat_period` set.
[ring: &amp;lt;ring&amp;gt;]

# Address and port number where the compactor API is served.
# CLI flag: -common.compactor-address
[compactor_address: &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;analytics&#34;&gt;analytics&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;analytics&lt;/code&gt; block configures the reporting of Loki analytics to grafana.com.&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;# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
#
# Statistics help us better understand how Loki is used, and they show us performance
# levels for most users. This helps us prioritize features and documentation.
# For more information on what&amp;#39;s sent, look at
# https://github.com/grafana/loki/blob/main/pkg/usagestats/stats.go
# Refer to the buildReport method to see what goes into a report.
#
# When true, enables usage reporting.
# CLI flag: -reporting.enabled
[reporting_enabled: &amp;lt;boolean&amp;gt;: default = true]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;storage&#34;&gt;storage&lt;/h3&gt;
&lt;p&gt;The common &lt;code&gt;storage&lt;/code&gt; block defines a common storage to be reused by different
components as a way to facilitate storage configuration.
If any specific configuration for an object storage client have been provided elsewhere in the configuration file, the specific configuration will supersede the common storage configuration.&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 Azure as the common storage.
[azure: &amp;lt;azure_storage_config&amp;gt;]

# Configures GCS as the common storage.
[gcs: &amp;lt;gcs_storage_config&amp;gt;]

# Configures S3 as the common storage.
[s3: &amp;lt;s3_storage_config&amp;gt;]

# Configures Swift as the common storage.
[swift: &amp;lt;swift_storage_config&amp;gt;]

# Configures a (local) file system as the common storage.
[filesystem: &amp;lt;filesystem&amp;gt;]

# Configures Baidu Object Storage (BOS) as the common storage.
[bos: &amp;lt;bos_storage_config&amp;gt;]

# The `hedging_config` configures how to hedge requests for the storage.
[hedging: &amp;lt;hedging_config&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;filesystem&#34;&gt;filesystem&lt;/h3&gt;
&lt;p&gt;The common &lt;code&gt;filesystem&lt;/code&gt; block configures a local file system as a general
storage for various types of data generated by Loki.&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 system directory to be used for chunks storage.
[chunks_directory: &amp;lt;filename&amp;gt; | default = &amp;#34;&amp;#34;]

# File system directory to be used for rules storage.
[rules_directory: &amp;lt;filename&amp;gt; | default = &amp;#34;&amp;#34;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;ring&#34;&gt;ring&lt;/h3&gt;
&lt;p&gt;The common &lt;code&gt;ring&lt;/code&gt; block defines a ring configuration used by a Loki component.&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;# The key-value store used to share the hash ring across multiple instances.
kvstore:
  # Backend storage to use for the ring. Supported values are: consul, etcd,
  # inmemory, memberlist, multi.
  # CLI flag: -&amp;lt;prefix&amp;gt;.store
  [store: &amp;lt;string&amp;gt; | default = &amp;#34;memberlist&amp;#34;]

  # The prefix for the keys in the store. Should end with a /.
  # CLI flag: -&amp;lt;prefix&amp;gt;.prefix
  [prefix: &amp;lt;string&amp;gt; | default = &amp;#34;collectors/&amp;#34;]

  # The consul_config configures the consul client.
  [consul: &amp;lt;consul_config&amp;gt;]

  # The etcd_config configures the etcd client.
  [etcd: &amp;lt;etcd_config&amp;gt;]

  multi:
    # Primary backend storage used by multi-client.
    # CLI flag: -&amp;lt;prefix&amp;gt;.multi.primary
    [primary: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

    # Secondary backend storage used by multi-client.
    # CLI flag: -&amp;lt;prefix&amp;gt;.multi.secondary
    [secondary: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

    # Mirror writes to secondary store.
    # CLI flag: -&amp;lt;prefix&amp;gt;.multi.mirror-enabled
    [mirror_enabled: &amp;lt;boolean&amp;gt; | default = false]

    # Timeout for storing value to secondary store.
    # CLI flag: -&amp;lt;prefix&amp;gt;.multi.mirror-timeout
    [mirror_timeout: &amp;lt;duration&amp;gt; | default = 2s]

# Interval between heartbeats sent to the ring. 0 = disabled.
# CLI flag: -&amp;lt;prefix&amp;gt;.heartbeat-period
[heartbeat_period: &amp;lt;duration&amp;gt; | default = 15s]

# The heartbeat timeout after which store gateways are considered unhealthy
# within the ring. 0 = never (timeout disabled). This option needs be set both
# on the store-gateway and querier when running in microservices mode.
# CLI flag: -&amp;lt;prefix&amp;gt;.heartbeat-timeout
[heartbeat_timeout: &amp;lt;duration&amp;gt; | default = 1m]

# File path where tokens are stored. If empty, tokens are neither stored at
# shutdown nor restored at startup.
# CLI flag: -&amp;lt;prefix&amp;gt;.tokens-file-path
[tokens_file_path: &amp;lt;string&amp;gt; | default = &amp;#34;&amp;#34;]

# True to enable zone-awareness and replicate blocks across different
# availability zones.
# CLI flag: -&amp;lt;prefix&amp;gt;.zone-awareness-enabled
[zone_awareness_enabled: &amp;lt;boolean&amp;gt; | default = false]

# Name of network interface to read addresses from.
# CLI flag: -&amp;lt;prefix&amp;gt;.instance-interface-names
[instance_interface_names: &amp;lt;list of string&amp;gt; | default = [&amp;lt;private network interfaces&amp;gt;]]

# IP address to advertise in the ring.
# CLI flag: -&amp;lt;prefix&amp;gt;.instance-addr
[instance_addr: &amp;lt;list of string&amp;gt; | default = first from instance_interface_names]

# Port to advertise in the ring
# CLI flag: -&amp;lt;prefix&amp;gt;.instance-port
[instance_port: &amp;lt;list of string&amp;gt; | default = server.grpc-listen-port]

# Instance ID to register in the ring.
# CLI flag: -&amp;lt;prefix&amp;gt;.instance-id
[instance_id: &amp;lt;list of string&amp;gt; | default = os.Hostname()]

# The availability zone where this instance is running. Required if
# zone-awareness is enabled.
# CLI flag: -&amp;lt;prefix&amp;gt;.instance-availability-zone
[instance_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;runtime-configuration-file&#34;&gt;Runtime Configuration file&lt;/h2&gt;
&lt;p&gt;Loki has a concept of &amp;ldquo;runtime config&amp;rdquo; file, which is simply a file that is reloaded while Loki is running. It is used by some Loki components to allow operator to change some aspects of Loki configuration without restarting it. File is specified by using &lt;code&gt;-runtime-config.file=&amp;lt;filename&amp;gt;&lt;/code&gt; flag and reload period (which defaults to 10 seconds) can be changed by &lt;code&gt;-runtime-config.reload-period=&amp;lt;duration&amp;gt;&lt;/code&gt; flag. Previously this mechanism was only used by limits overrides, and flags were called &lt;code&gt;-limits.per-user-override-config=&amp;lt;filename&amp;gt;&lt;/code&gt; and &lt;code&gt;-limits.per-user-override-period=10s&lt;/code&gt; respectively. These are still used, if &lt;code&gt;-runtime-config.file=&amp;lt;filename&amp;gt;&lt;/code&gt; is not specified.&lt;/p&gt;
&lt;p&gt;At the moment, two components use runtime configuration: limits and multi KV store.&lt;/p&gt;
&lt;p&gt;Options for runtime configuration reload can also be configured via YAML:&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;# Configuration file to periodically check and reload.
[file: &amp;lt;string&amp;gt;: default = empty]

# How often to check the file.
[period: &amp;lt;duration&amp;gt;: default 10s]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Example runtime configuration file:&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;overrides:
  tenant1:
    ingestion_rate_mb: 10
    max_streams_per_user: 100000
    max_chunks_per_query: 100000
  tenant2:
    max_streams_per_user: 1000000
    max_chunks_per_query: 1000000

multi_kv_config:
    mirror-enabled: false
    primary: consul&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;accept-out-of-order-writes&#34;&gt;Accept out-of-order writes&lt;/h2&gt;
&lt;p&gt;Since the beginning of Loki, log entries had to be written to Loki in order
by time.
This limitation has been lifted.
Out-of-order writes are enabled globally by default, but can be disabled/enabled
on a cluster or per-tenant basis.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;To disable out-of-order writes for all tenants,
place in the &lt;code&gt;limits_config&lt;/code&gt; section:&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;limits_config:
    unordered_writes: false&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To disable out-of-order writes for specific tenants,
configure a runtime configuration file:&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;runtime_config: overrides.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In the &lt;code&gt;overrides.yaml&lt;/code&gt; file, add &lt;code&gt;unordered_writes&lt;/code&gt; for each tenant
permitted to have out-of-order writes:&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;overrides:
  &amp;#34;tenantA&amp;#34;:
    unordered_writes: false&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;How far into the past accepted out-of-order log entries may be
is configurable with &lt;code&gt;max_chunk_age&lt;/code&gt;.
&lt;code&gt;max_chunk_age&lt;/code&gt; defaults to 1 hour.
Loki calculates the earliest time that out-of-order entries may have
and be accepted with&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;time_of_most_recent_line - (max_chunk_age/2)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Log entries with timestamps that are after this earliest time are accepted.
Log entries further back in time return an out-of-order error.&lt;/p&gt;
&lt;p&gt;For example, if &lt;code&gt;max_chunk_age&lt;/code&gt; is 2 hours
and the stream &lt;code&gt;{foo=&amp;quot;bar&amp;quot;}&lt;/code&gt; has one entry at &lt;code&gt;8:00&lt;/code&gt;,
Loki will accept data for that stream as far back in time as &lt;code&gt;7:00&lt;/code&gt;.
If another log line is written at &lt;code&gt;10:00&lt;/code&gt;,
Loki will accept data for that stream as far back in time as &lt;code&gt;9:00&lt;/code&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="configuring-grafana-loki">Configuring Grafana Loki&lt;/h1>
&lt;p>Grafana Loki is configured in a YAML file (usually referred to as &lt;code>loki.yaml&lt;/code> )
which contains information on the Loki server and its individual components,
depending on which mode Loki is launched in.&lt;/p></description></item><item><title>Clients</title><link>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/clients/</link><pubDate>Mon, 14 Apr 2025 21:05:47 +0000</pubDate><guid>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/clients/</guid><content><![CDATA[&lt;h1 id=&#34;grafana-loki-clients&#34;&gt;Grafana Loki clients&lt;/h1&gt;
&lt;p&gt;The following clients are developed and supported (for those customers who have purchased a support contract) by Grafana Labs for sending logs to Loki:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;/docs/agent/latest/&#34;&gt;Grafana Agent&lt;/a&gt; - The Grafana Agent is the recommended client for the Grafana stack. It can  collect telemetry data for metrics, logs, traces, and continuous profiles and is fully compatible with the Prometheus, OpenTelemetry, and Grafana open source ecosystems.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/enterprise-logs/v1.9.x/loki/clients/promtail/&#34;&gt;Promtail&lt;/a&gt; - Promtail is a popular choice when you&amp;rsquo;re running Kubernetes, as you can configure it to automatically scrape logs from pods running on the same node that Promtail runs on. Promtail and Prometheus running together in Kubernetes enables powerful debugging: if Prometheus and Promtail use the same labels, users can use tools like Grafana to switch between metrics and logs based on the label set.&lt;br /&gt;
Promtail is also the client of choice on bare-metal since it can be configured to tail logs from all files given a host path. It is the easiest way to send logs to Loki from plain-text files (for example, things that log to &lt;code&gt;/var/log/*.log&lt;/code&gt;).
Lastly, Promtail works well if you want to extract metrics from logs such as counting the occurrences of a particular message.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/xk6-loki&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;xk6-loki&lt;/code&gt;&lt;/a&gt; - The &lt;code&gt;xk6-loki&lt;/code&gt; extension lets you perform &lt;a href=&#34;/docs/enterprise-logs/v1.9.x/loki/clients/k6/&#34;&gt;load testing on Loki&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;third-party-clients&#34;&gt;Third-party clients&lt;/h2&gt;
&lt;p&gt;The following clients have been developed by the Loki community or other third-parties and can be used to send log data to Loki.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Grafana Labs cannot provide support for third-party clients. Once an issue has been determined to be with the client and not Loki, it is the responsibility of the customer to work with the associated vendor or project for bug fixes to these clients.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;The following are popular third-party Loki clients:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;/docs/enterprise-logs/v1.9.x/loki/clients/docker-driver/&#34;&gt;Docker Driver&lt;/a&gt; - When using Docker and not Kubernetes, the Docker logging driver for Loki should be used as it automatically adds labels appropriate to the running container.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/enterprise-logs/v1.9.x/loki/clients/fluentbit/&#34;&gt;Fluent Bit&lt;/a&gt; - The Fluent Bit plugin is ideal when you already have Fluentd deployed and you already have configured &lt;code&gt;Parser&lt;/code&gt; and &lt;code&gt;Filter&lt;/code&gt; plugins.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/enterprise-logs/v1.9.x/loki/clients/fluentd/&#34;&gt;Fluentd&lt;/a&gt; - The Fluentd plugin is ideal when you already have Fluentd deployed and you already have configured &lt;code&gt;Parser&lt;/code&gt; and &lt;code&gt;Filter&lt;/code&gt; plugins. Fluentd also works well for extracting metrics from logs when using itsPrometheus plugin.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/enterprise-logs/v1.9.x/loki/clients/lambda-promtail/&#34;&gt;Lambda Promtail&lt;/a&gt; - This is a workflow combining the Promtail push-api &lt;a href=&#34;/docs/enterprise-logs/v1.9.x/loki/clients/promtail/configuration/#loki_push_api&#34;&gt;scrape config&lt;/a&gt; and the &lt;a href=&#34;/docs/enterprise-logs/v1.9.x/loki/clients/lambda-promtail/&#34;&gt;lambda-promtail&lt;/a&gt; AWS Lambda function which pipes logs from Cloudwatch to Loki. This is a good choice if you&amp;rsquo;re looking to try out Loki in a low-footprint way or if you wish to monitor AWS lambda logs in Loki.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/enterprise-logs/v1.9.x/loki/clients/logstash/&#34;&gt;Logstash&lt;/a&gt; - If you are already using logstash and/or beats, this will be the easiest way to start. By adding our output plugin you can quickly try Loki without doing big configuration changes.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="grafana-loki-clients">Grafana Loki clients&lt;/h1>
&lt;p>The following clients are developed and supported (for those customers who have purchased a support contract) by Grafana Labs for sending logs to Loki:&lt;/p></description></item><item><title>Alerting and Recording Rules</title><link>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/rules/</link><pubDate>Tue, 16 Jul 2024 15:42:20 +0000</pubDate><guid>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/rules/</guid><content><![CDATA[&lt;h1 id=&#34;rules-and-the-ruler&#34;&gt;Rules and the Ruler&lt;/h1&gt;
&lt;p&gt;Grafana Loki includes a component called the ruler. The ruler is responsible for continually evaluating a set of configurable queries and performing an action based on the result.&lt;/p&gt;
&lt;p&gt;This example configuration sources rules from a local disk.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;#ruler-storage&#34;&gt;Ruler storage&lt;/a&gt; provides further details.&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;ruler:
  storage:
    type: local
    local:
      directory: /tmp/rules
  rule_path: /tmp/scratch
  alertmanager_url: http://localhost
  ring:
    kvstore:
      store: inmemory
  enable_api: true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;We support two kinds of rules: &lt;a href=&#34;#alerting-rules&#34;&gt;alerting&lt;/a&gt; rules and &lt;a href=&#34;#recording-rules&#34;&gt;recording&lt;/a&gt; rules.&lt;/p&gt;
&lt;h2 id=&#34;alerting-rules&#34;&gt;Alerting Rules&lt;/h2&gt;
&lt;p&gt;We support &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus-compatible&lt;/a&gt; alerting rules. From Prometheus&amp;rsquo; documentation:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Alerting rules allow you to define alert conditions based on Prometheus expression language expressions and to send notifications about firing alerts to an external service.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Loki alerting rules are exactly the same, except they use LogQL for their expressions.&lt;/p&gt;
&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;
&lt;p&gt;A complete example of a rules file:&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;groups:
  - name: should_fire
    rules:
      - alert: HighPercentageError
        expr: |
          sum(rate({app=&amp;#34;foo&amp;#34;, env=&amp;#34;production&amp;#34;} |= &amp;#34;error&amp;#34; [5m])) by (job)
            /
          sum(rate({app=&amp;#34;foo&amp;#34;, env=&amp;#34;production&amp;#34;}[5m])) by (job)
            &amp;gt; 0.05
        for: 10m
        labels:
            severity: page
        annotations:
            summary: High request latency
  - name: credentials_leak
    rules: 
      - alert: http-credentials-leaked
        annotations: 
          message: &amp;#34;{{ $labels.job }} is leaking http basic auth credentials.&amp;#34;
        expr: &amp;#39;sum by (cluster, job, pod) (count_over_time({namespace=&amp;#34;prod&amp;#34;} |~ &amp;#34;http(s?)://(\\w&amp;#43;):(\\w&amp;#43;)@&amp;#34; [5m]) &amp;gt; 0)&amp;#39;
        for: 10m
        labels: 
          severity: critical&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;recording-rules&#34;&gt;Recording Rules&lt;/h2&gt;
&lt;p&gt;We support &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#recording-rules&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus-compatible&lt;/a&gt; recording rules. From Prometheus&amp;rsquo; documentation:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Recording rules allow you to precompute frequently needed or computationally expensive expressions and save their result as a new set of time series.&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Querying the precomputed result will then often be much faster than executing the original expression every time it is needed. This is especially useful for dashboards, which need to query the same expression repeatedly every time they refresh.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Loki allows you to run &lt;a href=&#34;../logql/metric_queries&#34;&gt;metric queries&lt;/a&gt; over your logs, which means
that you can derive a numeric aggregation from your logs, like calculating the number of requests over time from your NGINX access log.&lt;/p&gt;
&lt;h3 id=&#34;example-1&#34;&gt;Example&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: NginxRules
interval: 1m
rules:
  - record: nginx:requests:rate1m
    expr: |
      sum(
        rate({container=&amp;#34;nginx&amp;#34;}[1m])
      )
    labels:
      cluster: &amp;#34;us-central1&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This query (&lt;code&gt;expr&lt;/code&gt;) will be executed every 1 minute (&lt;code&gt;interval&lt;/code&gt;), the result of which will be stored in the metric
name we have defined (&lt;code&gt;record&lt;/code&gt;). This metric named &lt;code&gt;nginx:requests:rate1m&lt;/code&gt; can now be sent to Prometheus, where it will be stored
just like any other metric.&lt;/p&gt;
&lt;h3 id=&#34;remote-write&#34;&gt;Remote-Write&lt;/h3&gt;
&lt;p&gt;With recording rules, you can run these metric queries continually on an interval, and have the resulting metrics written
to a Prometheus-compatible remote-write endpoint. They produce Prometheus metrics from log entries.&lt;/p&gt;
&lt;p&gt;At the time of writing, these are the compatible backends that support this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/disabled_features/#remote-write-receiver&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus&lt;/a&gt; (&lt;code&gt;&amp;gt;=v2.25.0&lt;/code&gt;):
Prometheus is generally a pull-based system, but since &lt;code&gt;v2.25.0&lt;/code&gt; has allowed for metrics to be written directly to it as well.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/mimir/latest/operators-guide/reference-http-api/#remote-write&#34;&gt;Grafana Mimir&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://thanos.io/tip/components/receive.md/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Thanos (&lt;code&gt;Receiver&lt;/code&gt;)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here is an example remote-write configuration for sending to a local Prometheus 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;ruler:
  ... other settings ...
  
  remote_write:
    enabled: true
    client:
      url: http://localhost:9090/api/v1/write&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Further configuration options can be found under &lt;a href=&#34;../configuration#ruler&#34;&gt;ruler&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;operations&#34;&gt;Operations&lt;/h3&gt;
&lt;p&gt;Refer to the &lt;a href=&#34;../operations/recording-rules/&#34;&gt;Recording Rules&lt;/a&gt; page.&lt;/p&gt;
&lt;h2 id=&#34;use-cases&#34;&gt;Use cases&lt;/h2&gt;
&lt;p&gt;The Ruler&amp;rsquo;s Prometheus compatibility further accentuates the marriage between metrics and logs. For those looking to get started with metrics and alerts based on logs, or wondering why this might be useful, here are a few use cases we think fit very well.&lt;/p&gt;
&lt;h3 id=&#34;black-box-monitoring&#34;&gt;Black box monitoring&lt;/h3&gt;
&lt;p&gt;We don&amp;rsquo;t always control the source code of applications we run. Load balancers and a myriad of other components, both open source and closed third-party, support our applications while they don&amp;rsquo;t expose the metrics we want. Some don&amp;rsquo;t expose any metrics at all. Loki&amp;rsquo;s alerting and recording rules can produce metrics and alert on the state of the system, bringing the components into our observability stack by using the logs. This is an incredibly powerful way to introduce advanced observability into legacy architectures.&lt;/p&gt;
&lt;h3 id=&#34;event-alerting&#34;&gt;Event alerting&lt;/h3&gt;
&lt;p&gt;Sometimes you want to know whether &lt;em&gt;any&lt;/em&gt; instance of something has occurred. Alerting based on logs can be a great way to handle this, such as finding examples of leaked authentication credentials:&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: credentials_leak
  rules: 
    - alert: http-credentials-leaked
      annotations: 
        message: &amp;#34;{{ $labels.job }} is leaking http basic auth credentials.&amp;#34;
      expr: &amp;#39;sum by (cluster, job, pod) (count_over_time({namespace=&amp;#34;prod&amp;#34;} |~ &amp;#34;http(s?)://(\\w&amp;#43;):(\\w&amp;#43;)@&amp;#34; [5m]) &amp;gt; 0)&amp;#39;
      for: 10m
      labels: 
        severity: critical&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;alerting-on-high-cardinality-sources&#34;&gt;Alerting on high-cardinality sources&lt;/h3&gt;
&lt;p&gt;Another great use case is alerting on high cardinality sources. These are things which are difficult/expensive to record as metrics because the potential label set is huge. A great example of this is per-tenant alerting in multi-tenanted systems like Loki. It&amp;rsquo;s a common balancing act between the desire to have per-tenant metrics and the cardinality explosion that ensues (adding a single &lt;em&gt;tenant&lt;/em&gt; label to an existing Prometheus metric would increase it&amp;rsquo;s cardinality by the number of tenants).&lt;/p&gt;
&lt;p&gt;Creating these alerts in LogQL is attractive because these metrics can be extracted at &lt;em&gt;query time&lt;/em&gt;, meaning we don&amp;rsquo;t suffer the cardinality explosion in our metrics store.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; As an example, we can use LogQL v2 to help Loki to monitor &lt;em&gt;itself&lt;/em&gt;, alerting us when specific tenants have queries that take longer than 10s to complete! To do so, we&amp;rsquo;d use the following query: &lt;code&gt;sum by (org_id) (rate({job=&amp;quot;loki-prod/query-frontend&amp;quot;} |= &amp;quot;metrics.go&amp;quot; | logfmt | duration &amp;gt; 10s [1m]))&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;interacting-with-the-ruler&#34;&gt;Interacting with the Ruler&lt;/h2&gt;
&lt;p&gt;Because the rule files are identical to Prometheus rule files, we can interact with the Loki Ruler via &lt;a href=&#34;https://github.com/grafana/cortex-tools#rules&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;cortextool&lt;/code&gt;&lt;/a&gt;. The CLI is in early development, but it works with both Loki and Cortex. Pass the &lt;code&gt;--backend=loki&lt;/code&gt; option when using it with Loki.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Not all commands in cortextool currently support Loki.&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; cortextool was intended to run against multi-tenant Loki, commands need an &lt;code&gt;--id=&lt;/code&gt; flag set to the Loki instance ID or set the environment variable &lt;code&gt;CORTEX_TENANT_ID&lt;/code&gt;.  If Loki is running in single tenant mode, the required ID is &lt;code&gt;fake&lt;/code&gt; (yes we know this might seem alarming but it&amp;rsquo;s totally fine, no it can&amp;rsquo;t be changed)&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;An example workflow is included below:&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;sh&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-sh&#34;&gt;# lint the rules.yaml file ensuring it&amp;#39;s valid and reformatting it if necessary
cortextool rules lint --backend=loki ./output/rules.yaml

# diff rules against the currently managed ruleset in Loki
cortextool rules diff --rule-dirs=./output --backend=loki

# ensure the remote ruleset matches your local ruleset, creating/updating/deleting remote rules which differ from your local specification.
cortextool rules sync --rule-dirs=./output --backend=loki

# print the remote ruleset
cortextool rules print --backend=loki&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;There is also a &lt;a href=&#34;https://github.com/grafana/cortex-rules-action&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;github action&lt;/a&gt; available for &lt;code&gt;cortex-tool&lt;/code&gt;, so you can add it into your CI/CD pipelines!&lt;/p&gt;
&lt;p&gt;For instance, you can sync rules on master builds via&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: sync-cortex-rules-and-alerts
on:
  push:
    branches:
      - master
env:
  CORTEX_ADDRESS: &amp;#39;&amp;lt;fill me in&amp;gt;&amp;#39;
  CORTEX_TENANT_ID: &amp;#39;&amp;lt;fill me in&amp;gt;&amp;#39;
  CORTEX_API_KEY: ${{ secrets.API_KEY }}
  RULES_DIR: &amp;#39;output/&amp;#39;
jobs:
  sync-loki-alerts:
    runs-on: ubuntu-18.04
    steps:
      - name: Lint Rules
        uses: grafana/cortex-rules-action@v0.4.0
        env:
          ACTION: &amp;#39;lint&amp;#39;
        with:
          args: --backend=loki
      - name: Diff rules
        uses: grafana/cortex-rules-action@v0.4.0
        env:
          ACTION: &amp;#39;diff&amp;#39;
        with:
          args: --backend=loki
      - name: Sync rules
        if: ${{ !contains(steps.diff-rules.outputs.detailed, &amp;#39;no changes detected&amp;#39;) }}
        uses: grafana/cortex-rules-action@v0.4.0
        env:
          ACTION: &amp;#39;sync&amp;#39;
        with:
          args: --backend=loki
      - name: Print rules
        uses: grafana/cortex-rules-action@v0.4.0
        env:
          ACTION: &amp;#39;print&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;scheduling-and-best-practices&#34;&gt;Scheduling and best practices&lt;/h2&gt;
&lt;p&gt;One option to scale the Ruler is by scaling it horizontally. However, with multiple Ruler instances running they will need to coordinate to determine which instance will evaluate which rule. Similar to the ingesters, the Rulers establish a hash ring to divide up the responsibilities of evaluating rules.&lt;/p&gt;
&lt;p&gt;The possible configurations are listed fully in the &lt;a href=&#34;../configuration/&#34;&gt;configuration documentation&lt;/a&gt;, but in order to shard rules across multiple Rulers, the rules API must be enabled via flag (&lt;code&gt;-ruler.enable-api&lt;/code&gt;) or config file parameter. Secondly, the Ruler requires it&amp;rsquo;s own ring be configured. From there the Rulers will shard and handle the division of rules automatically. Unlike ingesters, Rulers do not hand over responsibility: all rules are re-sharded randomly every time a Ruler is added to or removed from the ring.&lt;/p&gt;
&lt;p&gt;A full sharding-enabled Ruler example is:&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;ruler:
    alertmanager_url: &amp;lt;alertmanager_endpoint&amp;gt;
    enable_alertmanager_v2: true
    enable_api: true
    enable_sharding: true
    ring:
        kvstore:
            consul:
                host: consul.loki-dev.svc.cluster.local:8500
            store: consul
    rule_path: /tmp/rules
    storage:
        gcs:
            bucket_name: &amp;lt;loki-rules-bucket&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;ruler-storage&#34;&gt;Ruler storage&lt;/h2&gt;
&lt;p&gt;The Ruler supports five kinds of storage: azure, gcs, s3, swift, and local. Most kinds of storage work with the sharded Ruler configuration in an obvious way, i.e. configure all Rulers to use the same backend.&lt;/p&gt;
&lt;p&gt;The local implementation reads the rule files off of the local filesystem. This is a read-only backend that does not support the creation and deletion of rules through the &lt;a href=&#34;../api/#ruler&#34;&gt;Ruler API&lt;/a&gt;. Despite the fact that it reads the local filesystem this method can still be used in a sharded Ruler configuration if the operator takes care to load the same rules to every Ruler. For instance, this could be accomplished by mounting a &lt;a href=&#34;https://kubernetes.io/docs/concepts/configuration/configmap/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Kubernetes ConfigMap&lt;/a&gt; onto every Ruler pod.&lt;/p&gt;
&lt;p&gt;A typical local configuration might look something like:&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;  -ruler.storage.type=local
  -ruler.storage.local.directory=/tmp/loki/rules&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;With the above configuration, the Ruler would expect the following layout:&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;/tmp/loki/rules/&amp;lt;tenant id&amp;gt;/rules1.yaml
                           /rules2.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Yaml files are expected to be &lt;a href=&#34;#Prometheus_Compatible&#34;&gt;Prometheus compatible&lt;/a&gt; but include LogQL expressions as specified in the beginning of this doc.&lt;/p&gt;
&lt;h2 id=&#34;future-improvements&#34;&gt;Future improvements&lt;/h2&gt;
&lt;p&gt;There are a few things coming to increase the robustness of this service. In no particular order:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;WAL for recording rule.&lt;/li&gt;
&lt;li&gt;Backend metric stores adapters for generated alert rule data.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;misc-details-metrics-backends-vs-in-memory&#34;&gt;Misc Details: Metrics backends vs in-memory&lt;/h2&gt;
&lt;p&gt;Currently the Loki Ruler is decoupled from a backing Prometheus store. Generally, the result of evaluating rules as well as the history of the alert&amp;rsquo;s state are stored as a time series. Loki is unable to store/retrieve these in order to allow it to run independently of i.e. Prometheus. As a workaround, Loki keeps a small in memory store whose purpose is to lazy load past evaluations when rescheduling or resharding Rulers. In the future, Loki will support optional metrics backends, allowing storage of these metrics for auditing &amp;amp; performance benefits.&lt;/p&gt;
]]></content><description>&lt;h1 id="rules-and-the-ruler">Rules and the Ruler&lt;/h1>
&lt;p>Grafana Loki includes a component called the ruler. The ruler is responsible for continually evaluating a set of configurable queries and performing an action based on the result.&lt;/p></description></item><item><title>LogQL</title><link>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/logql/</link><pubDate>Tue, 16 Jul 2024 15:42:20 +0000</pubDate><guid>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/logql/</guid><content><![CDATA[&lt;h1 id=&#34;logql-log-query-language&#34;&gt;LogQL: Log query language&lt;/h1&gt;
&lt;p&gt;LogQL is Grafana Loki&amp;rsquo;s PromQL-inspired query language.
Queries act as if they are a distributed &lt;code&gt;grep&lt;/code&gt; to aggregate log sources.
LogQL uses labels and operators for filtering.&lt;/p&gt;
&lt;p&gt;There are two types of LogQL queries:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;log_queries/&#34;&gt;Log queries&lt;/a&gt; return the contents of log lines.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;metric_queries/&#34;&gt;Metric queries&lt;/a&gt; extend log queries to calculate values
based on query results.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;binary-operators&#34;&gt;Binary operators&lt;/h2&gt;
&lt;h3 id=&#34;arithmetic-operators&#34;&gt;Arithmetic operators&lt;/h3&gt;
&lt;p&gt;The following binary arithmetic operators exist in Loki:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&#43;&lt;/code&gt; (addition)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-&lt;/code&gt; (subtraction)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;*&lt;/code&gt; (multiplication)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/&lt;/code&gt; (division)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;%&lt;/code&gt; (modulo)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;^&lt;/code&gt; (power/exponentiation)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Binary arithmetic operators are defined between two literals (scalars), a literal and a vector, and two vectors.&lt;/p&gt;
&lt;p&gt;Between two literals, the behavior is obvious:
They evaluate to another literal that is the result of the operator applied to both scalar operands (&lt;code&gt;1 &#43; 1 = 2&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Between a vector and a literal, the operator is applied to the value of every data sample in the vector, e.g. if a time series vector is multiplied by 2, the result is another vector in which every sample value of the original vector is multiplied by 2.&lt;/p&gt;
&lt;p&gt;Between two vectors, a binary arithmetic operator is applied to each entry in the left-hand side vector and its matching element in the right-hand vector.
The result is propagated into the result vector with the grouping labels becoming the output label set. Entries for which no matching entry in the right-hand vector can be found are not part of the result.&lt;/p&gt;
&lt;p&gt;Pay special attention to &lt;a href=&#34;#order-of-operations&#34;&gt;operator order&lt;/a&gt; when chaining arithmetic operators.&lt;/p&gt;
&lt;h4 id=&#34;arithmetic-examples&#34;&gt;Arithmetic Examples&lt;/h4&gt;
&lt;p&gt;Implement a health check with a simple query:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;1 &amp;#43; 1&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Double the rate of a a log stream&amp;rsquo;s entries:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;sum(rate({app=&amp;#34;foo&amp;#34;}[1m])) * 2&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Get proportion of warning logs to error logs for the &lt;code&gt;foo&lt;/code&gt; app&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;sum(rate({app=&amp;#34;foo&amp;#34;, level=&amp;#34;warn&amp;#34;}[1m])) / sum(rate({app=&amp;#34;foo&amp;#34;, level=&amp;#34;error&amp;#34;}[1m]))&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;logical-and-set-operators&#34;&gt;Logical and set operators&lt;/h3&gt;
&lt;p&gt;These logical/set binary operators are only defined between two vectors:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;and&lt;/code&gt; (intersection)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;or&lt;/code&gt; (union)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;unless&lt;/code&gt; (complement)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;vector1 and vector2&lt;/code&gt; results in a vector consisting of the elements of vector1 for which there are elements in vector2 with exactly matching label sets.
Other elements are dropped.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;vector1 or vector2&lt;/code&gt; results in a vector that contains all original elements (label sets &#43; values) of vector1 and additionally all elements of vector2 which do not have matching label sets in vector1.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;vector1 unless vector2&lt;/code&gt; results in a vector consisting of the elements of vector1 for which there are no elements in vector2 with exactly matching label sets.
All matching elements in both vectors are dropped.&lt;/p&gt;
&lt;h5 id=&#34;binary-operators-examples&#34;&gt;Binary operators examples&lt;/h5&gt;
&lt;p&gt;This contrived query will return the intersection of these queries, effectively &lt;code&gt;rate({app=&amp;quot;bar&amp;quot;})&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;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;rate({app=~&amp;#34;foo|bar&amp;#34;}[1m]) and rate({app=&amp;#34;bar&amp;#34;}[1m])&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;comparison-operators&#34;&gt;Comparison operators&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;==&lt;/code&gt; (equality)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;!=&lt;/code&gt; (inequality)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;gt;&lt;/code&gt; (greater than)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;gt;=&lt;/code&gt; (greater than or equal to)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;&lt;/code&gt; (less than)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;=&lt;/code&gt; (less than or equal to)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Comparison operators are defined between scalar/scalar, vector/scalar, and vector/vector value pairs.
By default they filter.
Their behavior can be modified by providing &lt;code&gt;bool&lt;/code&gt; after the operator, which will return 0 or 1 for the value rather than filtering.&lt;/p&gt;
&lt;p&gt;Between two scalars, these operators result in another scalar that is either 0 (false) or 1 (true), depending on the comparison result.
The &lt;code&gt;bool&lt;/code&gt; modifier must &lt;strong&gt;not&lt;/strong&gt; be provided.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;1 &amp;gt;= 1&lt;/code&gt; is equivalent to &lt;code&gt;1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Between a vector and a scalar, these operators are applied to the value of every data sample in the vector, and vector elements between which the comparison result is false get dropped from the result vector.
If the &lt;code&gt;bool&lt;/code&gt; modifier is provided, vector elements that would be dropped instead have the value 0 and vector elements that would be kept have the value 1.&lt;/p&gt;
&lt;p&gt;Filters the streams which logged at least 10 lines in the last minute:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;count_over_time({foo=&amp;#34;bar&amp;#34;}[1m]) &amp;gt; 10&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Attach the value(s) &lt;code&gt;0&lt;/code&gt;/&lt;code&gt;1&lt;/code&gt; to streams that logged less/more than 10 lines:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;count_over_time({foo=&amp;#34;bar&amp;#34;}[1m]) &amp;gt; bool 10&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Between two vectors, these operators behave as a filter by default, applied to matching entries.
Vector elements for which the expression is not true or which do not find a match on the other side of the expression get dropped from the result, while the others are propagated into a result vector.
If the &lt;code&gt;bool&lt;/code&gt; modifier is provided, vector elements that would have been dropped instead have the value 0 and vector elements that would be kept have the value 1, with the grouping labels again becoming the output label set.&lt;/p&gt;
&lt;p&gt;Return the streams matching &lt;code&gt;app=foo&lt;/code&gt; without app labels that have higher counts within the last minute than their counterparts matching &lt;code&gt;app=bar&lt;/code&gt; without app labels:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;sum without(app) (count_over_time({app=&amp;#34;foo&amp;#34;}[1m])) &amp;gt; sum without(app) (count_over_time({app=&amp;#34;bar&amp;#34;}[1m]))&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Same as above, but vectors have their values set to &lt;code&gt;1&lt;/code&gt; if they pass the comparison or &lt;code&gt;0&lt;/code&gt; if they fail/would otherwise have been filtered out:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;sum without(app) (count_over_time({app=&amp;#34;foo&amp;#34;}[1m])) &amp;gt; bool sum without(app) (count_over_time({app=&amp;#34;bar&amp;#34;}[1m]))&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;order-of-operations&#34;&gt;Order of operations&lt;/h3&gt;
&lt;p&gt;When chaining or combining operators, you have to consider operator precedence:
Generally, you can assume regular &lt;a href=&#34;https://en.wikipedia.org/wiki/Order_of_operations&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;mathematical convention&lt;/a&gt; with operators on the same precedence level being left-associative.&lt;/p&gt;
&lt;p&gt;More details can be found in the &lt;a href=&#34;https://golang.org/ref/spec#Operator_precedence&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Golang language documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;1 &#43; 2 / 3&lt;/code&gt; is equal to &lt;code&gt;1 &#43; ( 2 / 3 )&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;2 * 3 % 2&lt;/code&gt; is evaluated as &lt;code&gt;(2 * 3) % 2&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;keywords-on-and-ignoring&#34;&gt;Keywords on and ignoring&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;ignoring&lt;/code&gt; keyword causes specified labels to be ignored during matching.
The syntax:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;&amp;lt;vector expr&amp;gt; &amp;lt;bin-op&amp;gt; ignoring(&amp;lt;labels&amp;gt;) &amp;lt;vector expr&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This example will return the machines which total count within the last minutes exceed average value for app &lt;code&gt;foo&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;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;max by(machine) (count_over_time({app=&amp;#34;foo&amp;#34;}[1m])) &amp;gt; bool ignoring(machine) avg(count_over_time({app=&amp;#34;foo&amp;#34;}[1m]))&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The on keyword reduces the set of considered labels to a specified list.
The syntax:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;&amp;lt;vector expr&amp;gt; &amp;lt;bin-op&amp;gt; on(&amp;lt;labels&amp;gt;) &amp;lt;vector expr&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This example will return every machine total count within the last minutes ratio in app &lt;code&gt;foo&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;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;sum by(machine) (count_over_time({app=&amp;#34;foo&amp;#34;}[1m])) / on() sum(count_over_time({app=&amp;#34;foo&amp;#34;}[1m]))&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;many-to-one-and-one-to-many-vector-matches&#34;&gt;Many-to-one and one-to-many vector matches&lt;/h3&gt;
&lt;p&gt;Many-to-one and one-to-many matchings occur when each vector element on the &amp;ldquo;one&amp;rdquo;-side can match with multiple elements on the &amp;ldquo;many&amp;rdquo;-side. You must explicitly request matching by using the group_left or group_right modifier, where left or right determines which vector has the higher cardinality.
The syntax:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;&amp;lt;vector expr&amp;gt; &amp;lt;bin-op&amp;gt; ignoring(&amp;lt;labels&amp;gt;) group_left(&amp;lt;labels&amp;gt;) &amp;lt;vector expr&amp;gt;
&amp;lt;vector expr&amp;gt; &amp;lt;bin-op&amp;gt; ignoring(&amp;lt;labels&amp;gt;) group_right(&amp;lt;labels&amp;gt;) &amp;lt;vector expr&amp;gt;
&amp;lt;vector expr&amp;gt; &amp;lt;bin-op&amp;gt; on(&amp;lt;labels&amp;gt;) group_left(&amp;lt;labels&amp;gt;) &amp;lt;vector expr&amp;gt;
&amp;lt;vector expr&amp;gt; &amp;lt;bin-op&amp;gt; on(&amp;lt;labels&amp;gt;) group_right(&amp;lt;labels&amp;gt;) &amp;lt;vector expr&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The label list provided with the group modifier contains additional labels from the &amp;ldquo;one&amp;rdquo;-side that are included in the result metrics. And a label should only appear in one of the lists specified by &lt;code&gt;on&lt;/code&gt; and &lt;code&gt;group_x&lt;/code&gt;. Every time series of the result vector must be uniquely identifiable.
Grouping modifiers can only be used for comparison and arithmetic. By default, the system matches &lt;code&gt;and&lt;/code&gt;, &lt;code&gt;unless&lt;/code&gt;, and &lt;code&gt;or&lt;/code&gt; operations with all entries in the right vector.&lt;/p&gt;
&lt;p&gt;The following example returns the rates requests partitioned by &lt;code&gt;app&lt;/code&gt; and &lt;code&gt;status&lt;/code&gt; as a percentage of total requests.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;sum by (app, status) (
  rate(
    {job=&amp;#34;http-server&amp;#34;}
      | json
      [5m]
  )
)
/ on (app) group_left
sum by (app) (
  rate(
    {job=&amp;#34;http-server&amp;#34;}
      | json
      [5m]
  )
)

=&amp;gt;
[
  {app=&amp;#34;foo&amp;#34;, status=&amp;#34;200&amp;#34;} =&amp;gt; 0.8
  {app=&amp;#34;foo&amp;#34;, status=&amp;#34;400&amp;#34;} =&amp;gt; 0.1
  {app=&amp;#34;foo&amp;#34;, status=&amp;#34;500&amp;#34;} =&amp;gt; 0.1
]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This version uses &lt;code&gt;group_left(&amp;lt;labels&amp;gt;)&lt;/code&gt; to include &lt;code&gt;&amp;lt;labels&amp;gt;&lt;/code&gt; from the right hand side in the result and returns the cost of discarded events per user, organization, and namespace:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;sum by (user, namespace) (
  rate(
    {job=&amp;#34;events&amp;#34;}
      | logfmt
      | discarded=&amp;#34;true&amp;#34;
      [5m]
  )
)
* on (user) group_left(organization)
max_over_time(
  {job=&amp;#34;cost-calculator&amp;#34;}
    | logfmt
    | unwrap cost
    [5m]
) by (user, organization)

=&amp;gt;
[
  {user=&amp;#34;foo&amp;#34;, namespace=&amp;#34;dev&amp;#34;, organization=&amp;#34;little-org&amp;#34;} =&amp;gt; 10
  {user=&amp;#34;foo&amp;#34;, namespace=&amp;#34;prod&amp;#34;, organization=&amp;#34;little-org&amp;#34;} =&amp;gt; 50
  {user=&amp;#34;bar&amp;#34;, namespace=&amp;#34;dev&amp;#34;, organization=&amp;#34;big-org&amp;#34;} =&amp;gt; 70
  {user=&amp;#34;bar&amp;#34;, namespace=&amp;#34;prod&amp;#34;, organization=&amp;#34;big-org&amp;#34;} =&amp;gt; 200
]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;p&gt;LogQL queries can be commented using the &lt;code&gt;#&lt;/code&gt; character:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;{app=&amp;#34;foo&amp;#34;} # anything that comes after will not be interpreted in your query&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;With multi-line LogQL queries, the query parser can exclude whole or partial lines using &lt;code&gt;#&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;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;{app=&amp;#34;foo&amp;#34;}
    | json
    # this line will be ignored
    | bar=&amp;#34;baz&amp;#34; # this checks if bar = &amp;#34;baz&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;pipeline-errors&#34;&gt;Pipeline Errors&lt;/h2&gt;
&lt;p&gt;There are multiple reasons which cause pipeline processing errors, such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A numeric label filter may fail to turn a label value into a number&lt;/li&gt;
&lt;li&gt;A metric conversion for a label may fail.&lt;/li&gt;
&lt;li&gt;A log line is not a valid json document.&lt;/li&gt;
&lt;li&gt;etc&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When those failures happen, Loki won&amp;rsquo;t filter out those log lines. Instead they are passed into the next stage of the pipeline with a new system label named &lt;code&gt;__error__&lt;/code&gt;. The only way to filter out errors is by using a label filter expressions. The &lt;code&gt;__error__&lt;/code&gt; label can&amp;rsquo;t be renamed via the language.&lt;/p&gt;
&lt;p&gt;For example to remove json errors:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;  {cluster=&amp;#34;ops-tools1&amp;#34;,container=&amp;#34;ingress-nginx&amp;#34;}
    | json
    | __error__ != &amp;#34;JSONParserErr&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Alternatively you can remove all error using a catch all matcher such as &lt;code&gt;__error__ = &amp;quot;&amp;quot;&lt;/code&gt; or even show only errors using &lt;code&gt;__error__ != &amp;quot;&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The filter should be placed after the stage that generated this error. This means if you need to remove errors from an unwrap expression it needs to be placed after the unwrap.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;quantile_over_time(
	0.99,
	{container=&amp;#34;ingress-nginx&amp;#34;,service=&amp;#34;hosted-grafana&amp;#34;}
	| json
	| unwrap response_latency_seconds
	| __error__=&amp;#34;&amp;#34;[1m]
	) by (cluster)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;Metric queries cannot contain errors, in case errors are found during execution, Loki will return an error and appropriate status code.&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
&lt;p&gt;Loki supports functions to operate on data.&lt;/p&gt;
&lt;h3 id=&#34;label_replace&#34;&gt;label_replace()&lt;/h3&gt;
&lt;p&gt;For each timeseries in &lt;code&gt;v&lt;/code&gt;,&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;label_replace(v instant-vector,
    dst_label string,
    replacement string,
    src_label string,
    regex string)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;matches the regular expression &lt;code&gt;regex&lt;/code&gt; against the label &lt;code&gt;src_label&lt;/code&gt;.
If it matches, then the timeseries is returned with the label &lt;code&gt;dst_label&lt;/code&gt; replaced by the expansion of &lt;code&gt;replacement&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$1&lt;/code&gt; is replaced with the first matching subgroup,
&lt;code&gt;$2&lt;/code&gt; with the second etc.
If the regular expression doesn&amp;rsquo;t match,
then the timeseries is returned unchanged.&lt;/p&gt;
&lt;p&gt;This example will return a vector with each time series having a &lt;code&gt;foo&lt;/code&gt; label with the value &lt;code&gt;a&lt;/code&gt; added to it:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;logql&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-logql&#34;&gt;label_replace(rate({job=&amp;#34;api-server&amp;#34;,service=&amp;#34;a:c&amp;#34;} |= &amp;#34;err&amp;#34; [1m]), &amp;#34;foo&amp;#34;, &amp;#34;$1&amp;#34;,
  &amp;#34;service&amp;#34;, &amp;#34;(.*):.*&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="logql-log-query-language">LogQL: Log query language&lt;/h1>
&lt;p>LogQL is Grafana Loki&amp;rsquo;s PromQL-inspired query language.
Queries act as if they are a distributed &lt;code>grep&lt;/code> to aggregate log sources.
LogQL uses labels and operators for filtering.&lt;/p></description></item><item><title>Operations</title><link>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/operations/</link><pubDate>Tue, 16 Jul 2024 15:42:20 +0000</pubDate><guid>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/operations/</guid><content><![CDATA[&lt;h1 id=&#34;operations&#34;&gt;Operations&lt;/h1&gt;
]]></content><description>&lt;h1 id="operations">Operations&lt;/h1></description></item><item><title>HTTP API</title><link>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/api/</link><pubDate>Tue, 16 Jul 2024 15:42:20 +0000</pubDate><guid>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/api/</guid><content><![CDATA[&lt;h1 id=&#34;grafana-loki-http-api&#34;&gt;Grafana Loki HTTP API&lt;/h1&gt;
&lt;p&gt;Grafana Loki exposes an HTTP API for pushing, querying, and tailing log data.
Note that authenticating against the API is
out of scope for Loki.&lt;/p&gt;
&lt;h2 id=&#34;microservices-mode&#34;&gt;Microservices mode&lt;/h2&gt;
&lt;p&gt;When deploying Loki in microservices mode, the set of endpoints exposed by each
component is different.&lt;/p&gt;
&lt;p&gt;These endpoints are exposed by all components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#identify-ready-loki-instance&#34;&gt;&lt;code&gt;GET /ready&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#return-exposed-prometheus-metrics&#34;&gt;&lt;code&gt;GET /metrics&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#list-current-configuration&#34;&gt;&lt;code&gt;GET /config&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#list-running-services&#34;&gt;&lt;code&gt;GET /services&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#list-build-information&#34;&gt;&lt;code&gt;GET /loki/api/v1/status/buildinfo&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These endpoints are exposed by the querier and the query frontend:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#query-loki&#34;&gt;&lt;code&gt;GET /loki/api/v1/query&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#query-loki-over-a-range-of-time&#34;&gt;&lt;code&gt;GET /loki/api/v1/query_range&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#list-labels-within-a-range-of-time&#34;&gt;&lt;code&gt;GET /loki/api/v1/labels&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#list-label-values-within-a-range-of-time&#34;&gt;&lt;code&gt;GET /loki/api/v1/label/&amp;lt;name&amp;gt;/values&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#list-series&#34;&gt;&lt;code&gt;GET /loki/api/v1/series&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#index-stats&#34;&gt;&lt;code&gt;GET /loki/api/v1/index/stats&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#stream-log-messages&#34;&gt;&lt;code&gt;GET /loki/api/v1/tail&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#push-log-entries-to-loki&#34;&gt;&lt;code&gt;POST /loki/api/v1/push&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#identify-ready-loki-instance&#34;&gt;&lt;code&gt;GET /ready&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#return-exposed-prometheus-metrics&#34;&gt;&lt;code&gt;GET /metrics&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deprecated&lt;/strong&gt; &lt;a href=&#34;#get-apipromtail&#34;&gt;&lt;code&gt;GET /api/prom/tail&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deprecated&lt;/strong&gt; &lt;a href=&#34;#get-apipromquery&#34;&gt;&lt;code&gt;GET /api/prom/query&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deprecated&lt;/strong&gt; &lt;a href=&#34;#get-apipromlabel&#34;&gt;&lt;code&gt;GET /api/prom/label&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deprecated&lt;/strong&gt; &lt;a href=&#34;#get-apipromlabelnamevalues&#34;&gt;&lt;code&gt;GET /api/prom/label/&amp;lt;name&amp;gt;/values&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deprecated&lt;/strong&gt; &lt;a href=&#34;#post-apiprompush&#34;&gt;&lt;code&gt;POST /api/prom/push&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These endpoints are exposed by the distributor:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#push-log-entries-to-loki&#34;&gt;&lt;code&gt;POST /loki/api/v1/push&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#display-distributor-consistent-hash-ring-status&#34;&gt;&lt;code&gt;GET /distributor/ring&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These endpoints are exposed by the ingester:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#flush-in-memory-chunks-to-backing-store&#34;&gt;&lt;code&gt;POST /flush&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#flush-in-memory-chunks-and-shut-down&#34;&gt;&lt;code&gt;POST /ingester/shutdown&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deprecated&lt;/strong&gt; &lt;a href=&#34;#post-ingesterflush_shutdown&#34;&gt;&lt;code&gt;POST /ingester/flush_shutdown&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The API endpoints starting with &lt;code&gt;/loki/&lt;/code&gt; are &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/api/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus API-compatible&lt;/a&gt; and the result formats can be used interchangeably.&lt;/p&gt;
&lt;p&gt;These endpoints are exposed by the ruler:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#ruler-ring-status&#34;&gt;&lt;code&gt;GET /ruler/ring&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#list-rule-groups&#34;&gt;&lt;code&gt;GET /loki/api/v1/rules&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#get-rule-groups-by-namespace&#34;&gt;&lt;code&gt;GET /loki/api/v1/rules/{namespace}&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#get-rule-group&#34;&gt;&lt;code&gt;GET /loki/api/v1/rules/{namespace}/{groupName}&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#set-rule-group&#34;&gt;&lt;code&gt;POST /loki/api/v1/rules/{namespace}&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#delete-rule-group&#34;&gt;&lt;code&gt;DELETE /loki/api/v1/rules/{namespace}/{groupName}&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#delete-namespace&#34;&gt;&lt;code&gt;DELETE /loki/api/v1/rules/{namespace}&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#list-rule-groups&#34;&gt;&lt;code&gt;GET /api/prom/rules&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#get-rule-groups-by-namespace&#34;&gt;&lt;code&gt;GET /api/prom/rules/{namespace}&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#get-rule-group&#34;&gt;&lt;code&gt;GET /api/prom/rules/{namespace}/{groupName}&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#set-rule-group&#34;&gt;&lt;code&gt;POST /api/prom/rules/{namespace}&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#delete-rule-group&#34;&gt;&lt;code&gt;DELETE /api/prom/rules/{namespace}/{groupName}&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#delete-namespace&#34;&gt;&lt;code&gt;DELETE /api/prom/rules/{namespace}&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#list-rules&#34;&gt;&lt;code&gt;GET /prometheus/api/v1/rules&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#list-alerts&#34;&gt;&lt;code&gt;GET /prometheus/api/v1/alerts&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These endpoints are exposed by the compactor:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#get-compactorring&#34;&gt;&lt;code&gt;GET /compactor/ring&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#post-lokiapiv1delete&#34;&gt;&lt;code&gt;POST /loki/api/v1/delete&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#get-lokiapiv1delete&#34;&gt;&lt;code&gt;GET /loki/api/v1/delete&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#delete-lokiapiv1delete&#34;&gt;&lt;code&gt;DELETE /loki/api/v1/delete&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A &lt;a href=&#34;../clients&#34;&gt;list of clients&lt;/a&gt; can be found in the clients documentation.&lt;/p&gt;
&lt;h2 id=&#34;matrix-vector-and-streams&#34;&gt;Matrix, vector, and streams&lt;/h2&gt;
&lt;p&gt;Some Loki API endpoints return a result of a matrix, a vector, or a stream:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Matrix: a table of values where each row represents a different label set
and the columns are each sample value for that row over the queried time.
Matrix types are only returned when running a query that computes some value.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Instant Vector: denoted in the type as just &lt;code&gt;vector&lt;/code&gt;, an Instant Vector
represents the latest value of a calculation for a given labelset. Instant
Vectors are only returned when doing a query against a single point in
time.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Stream: a Stream is a set of all values (logs) for a given label set over the
queried time range. Streams are the only type that will result in log lines
being returned.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;timestamp-formats&#34;&gt;Timestamp formats&lt;/h2&gt;
&lt;p&gt;The API accepts several formats for timestamps. An integer with ten or fewer digits is interpreted as a Unix timestamp in seconds. More than ten digits are interpreted as a Unix timestamp in nanoseconds. A floating point number is a Unix timestamp with fractions of a second.&lt;/p&gt;
&lt;p&gt;The timestamps can also be written in &lt;code&gt;RFC3339&lt;/code&gt; and &lt;code&gt;RFC3339Nano&lt;/code&gt; format, as supported by Go&amp;rsquo;s &lt;a href=&#34;https://pkg.go.dev/time&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;time&lt;/a&gt; package.&lt;/p&gt;
&lt;h2 id=&#34;query-loki&#34;&gt;Query Loki&lt;/h2&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;GET /loki/api/v1/query&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/loki/api/v1/query&lt;/code&gt; allows for doing queries against a single point in time. The URL
query parameters support the following values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;query&lt;/code&gt;: The &lt;a href=&#34;../logql/&#34;&gt;LogQL&lt;/a&gt; query to perform&lt;/li&gt;
&lt;li&gt;&lt;code&gt;limit&lt;/code&gt;: The max number of entries to return. It defaults to &lt;code&gt;100&lt;/code&gt;. Only applies to query types which produce a stream(log lines) response.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;time&lt;/code&gt;: The evaluation time for the query as a nanosecond Unix epoch or another &lt;a href=&#34;#timestamp-formats&#34;&gt;supported format&lt;/a&gt;. Defaults to now.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;direction&lt;/code&gt;: Determines the sort order of logs. Supported values are &lt;code&gt;forward&lt;/code&gt; or &lt;code&gt;backward&lt;/code&gt;. Defaults to &lt;code&gt;backward&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In microservices mode, &lt;code&gt;/loki/api/v1/query&lt;/code&gt; is exposed by the querier and the frontend.&lt;/p&gt;
&lt;p&gt;Response format:&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;{
  &amp;#34;status&amp;#34;: &amp;#34;success&amp;#34;,
  &amp;#34;data&amp;#34;: {
    &amp;#34;resultType&amp;#34;: &amp;#34;vector&amp;#34; | &amp;#34;streams&amp;#34;,
    &amp;#34;result&amp;#34;: [&amp;lt;vector value&amp;gt;] | [&amp;lt;stream value&amp;gt;],
    &amp;#34;stats&amp;#34; : [&amp;lt;statistics&amp;gt;]
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;where &lt;code&gt;&amp;lt;vector value&amp;gt;&lt;/code&gt; is:&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;{
  &amp;#34;metric&amp;#34;: {
    &amp;lt;label key-value pairs&amp;gt;
  },
  &amp;#34;value&amp;#34;: [
    &amp;lt;number: second unix epoch&amp;gt;,
    &amp;lt;string: value&amp;gt;
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;and &lt;code&gt;&amp;lt;stream value&amp;gt;&lt;/code&gt; is:&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;{
  &amp;#34;stream&amp;#34;: {
    &amp;lt;label key-value pairs&amp;gt;
  },
  &amp;#34;values&amp;#34;: [
    [
      &amp;lt;string: nanosecond unix epoch&amp;gt;,
      &amp;lt;string: log line&amp;gt;
    ],
    ...
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The items in the &lt;code&gt;values&lt;/code&gt; array are sorted by timestamp.
The most recent item is first when using &lt;code&gt;direction=backward&lt;/code&gt;.
The oldest item is first when using &lt;code&gt;direction=forward&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;See &lt;a href=&#34;#statistics&#34;&gt;statistics&lt;/a&gt; for information about the statistics returned by Loki.&lt;/p&gt;
&lt;h3 id=&#34;examples&#34;&gt;Examples&lt;/h3&gt;
&lt;p&gt;This example query&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -G -s  &amp;#34;http://localhost:3100/loki/api/v1/query&amp;#34; \
  --data-urlencode \
  &amp;#39;query=sum(rate({job=&amp;#34;varlogs&amp;#34;}[10m])) by (level)&amp;#39; | jq&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;gave this response:&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;JSON&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-json&#34;&gt;{
  &amp;#34;status&amp;#34;: &amp;#34;success&amp;#34;,
  &amp;#34;data&amp;#34;: {
    &amp;#34;resultType&amp;#34;: &amp;#34;vector&amp;#34;,
    &amp;#34;result&amp;#34;: [
      {
        &amp;#34;metric&amp;#34;: {},
        &amp;#34;value&amp;#34;: [
          1588889221,
          &amp;#34;1267.1266666666666&amp;#34;
        ]
      },
      {
        &amp;#34;metric&amp;#34;: {
          &amp;#34;level&amp;#34;: &amp;#34;warn&amp;#34;
        },
        &amp;#34;value&amp;#34;: [
          1588889221,
          &amp;#34;37.77166666666667&amp;#34;
        ]
      },
      {
        &amp;#34;metric&amp;#34;: {
          &amp;#34;level&amp;#34;: &amp;#34;info&amp;#34;
        },
        &amp;#34;value&amp;#34;: [
          1588889221,
          &amp;#34;37.69&amp;#34;
        ]
      }
    ],
    &amp;#34;stats&amp;#34;: {
      ...
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If your cluster has Multi-Tenancy enabled,
set the &lt;code&gt;X-Scope-OrgID&lt;/code&gt; header to identify the tenant you want to query.
Here is the same example query for the single tenant called &lt;code&gt;Tenant1&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;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -H &amp;#39;X-Scope-OrgID:Tenant1&amp;#39; \
  -G -s &amp;#34;http://localhost:3100/loki/api/v1/query&amp;#34; \
  --data-urlencode \
  &amp;#39;query=sum(rate({job=&amp;#34;varlogs&amp;#34;}[10m])) by (level)&amp;#39; | jq&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To query against the three tenants &lt;code&gt;Tenant1&lt;/code&gt;, &lt;code&gt;Tenant2&lt;/code&gt;, and &lt;code&gt;Tenant3&lt;/code&gt;,
specify the tenant names separated by the pipe (&lt;code&gt;|&lt;/code&gt;) character:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -H &amp;#39;X-Scope-OrgID:Tenant1|Tenant2|Tenant3&amp;#39; \
  -G -s &amp;#34;http://localhost:3100/loki/api/v1/query&amp;#34; \
  --data-urlencode \
  &amp;#39;query=sum(rate({job=&amp;#34;varlogs&amp;#34;}[10m])) by (level)&amp;#39; | jq&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The same example query for Grafana Enterprise Logs
uses Basic Authentication and specifies the tenant names as a &lt;code&gt;user&lt;/code&gt;.
The tenant names are separated by the pipe (&lt;code&gt;|&lt;/code&gt;) character.
The password in this example is an access policy token that has been
defined in the &lt;code&gt;API_TOKEN&lt;/code&gt; environment variable:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -u &amp;#34;Tenant1|Tenant2|Tenant3:$API_TOKEN&amp;#34; \
  -G -s &amp;#34;http://localhost:3100/loki/api/v1/query&amp;#34; \
  --data-urlencode \
  &amp;#39;query=sum(rate({job=&amp;#34;varlogs&amp;#34;}[10m])) by (level)&amp;#39; | jq&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;query-loki-over-a-range-of-time&#34;&gt;Query Loki over a range of time&lt;/h2&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;GET /loki/api/v1/query_range&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/loki/api/v1/query_range&lt;/code&gt; is used to do a query over a range of time and
accepts the following query parameters in the URL:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;query&lt;/code&gt;: The &lt;a href=&#34;../logql/&#34;&gt;LogQL&lt;/a&gt; query to perform&lt;/li&gt;
&lt;li&gt;&lt;code&gt;limit&lt;/code&gt;: The max number of entries to return. It defaults to &lt;code&gt;100&lt;/code&gt;. Only applies to query types which produce a stream(log lines) response.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;start&lt;/code&gt;: The start time for the query as a nanosecond Unix epoch or another &lt;a href=&#34;#timestamp-formats&#34;&gt;supported format&lt;/a&gt;. Defaults to one hour ago.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;end&lt;/code&gt;: The end time for the query as a nanosecond Unix epoch or another &lt;a href=&#34;#timestamp-formats&#34;&gt;supported format&lt;/a&gt;. Defaults to now.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;step&lt;/code&gt;: Query resolution step width in &lt;code&gt;duration&lt;/code&gt; format or float number of seconds. &lt;code&gt;duration&lt;/code&gt; refers to Prometheus duration strings of the form &lt;code&gt;[0-9]&#43;[smhdwy]&lt;/code&gt;. For example, 5m refers to a duration of 5 minutes. Defaults to a dynamic value based on &lt;code&gt;start&lt;/code&gt; and &lt;code&gt;end&lt;/code&gt;.  Only applies to query types which produce a matrix response.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;interval&lt;/code&gt;: &lt;span style=&#34;background-color:#f3f973;&#34;&gt;This parameter is experimental; see the explanation under Step versus interval.&lt;/span&gt; Only return entries at (or greater than) the specified interval, can be a &lt;code&gt;duration&lt;/code&gt; format or float number of seconds. Only applies to queries which produce a stream response.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;direction&lt;/code&gt;: Determines the sort order of logs. Supported values are &lt;code&gt;forward&lt;/code&gt; or &lt;code&gt;backward&lt;/code&gt;. Defaults to &lt;code&gt;backward.&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In microservices mode, &lt;code&gt;/loki/api/v1/query_range&lt;/code&gt; is exposed by the querier and the frontend.&lt;/p&gt;
&lt;h3 id=&#34;step-versus-interval&#34;&gt;Step versus interval&lt;/h3&gt;
&lt;p&gt;Use the &lt;code&gt;step&lt;/code&gt; parameter when making metric queries to Loki, or queries which return a matrix response.  It is evaluated in exactly the same way Prometheus evaluates &lt;code&gt;step&lt;/code&gt;.  First the query will be evaluated at &lt;code&gt;start&lt;/code&gt; and then evaluated again at &lt;code&gt;start &#43; step&lt;/code&gt; and again at &lt;code&gt;start &#43; step &#43; step&lt;/code&gt; until &lt;code&gt;end&lt;/code&gt; is reached.  The result will be a matrix of the query result evaluated at each step.&lt;/p&gt;
&lt;p&gt;Use the &lt;code&gt;interval&lt;/code&gt; parameter when making log queries to Loki, or queries which return a stream response. It is evaluated by returning a log entry at &lt;code&gt;start&lt;/code&gt;, then the next entry will be returned an entry with timestampe &amp;gt;= &lt;code&gt;start &#43; interval&lt;/code&gt;, and again at &lt;code&gt;start &#43; interval &#43; interval&lt;/code&gt; and so on until &lt;code&gt;end&lt;/code&gt; is reached.  It does not fill missing entries.&lt;/p&gt;
&lt;p&gt;&lt;span style=&#34;background-color:#f3f973;&#34;&gt;Note about the experimental nature of the interval parameter:&lt;/span&gt; This flag may be removed in the future, if so it will likely be in favor of a LogQL expression to perform similar behavior, however that is uncertain at this time.  &lt;a href=&#34;https://github.com/grafana/loki/issues/1779&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Issue 1779&lt;/a&gt; was created to track the discussion, if you are using &lt;code&gt;interval&lt;/code&gt; please go add your use case and thoughts to that issue.&lt;/p&gt;
&lt;p&gt;Response:&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;{
  &amp;#34;status&amp;#34;: &amp;#34;success&amp;#34;,
  &amp;#34;data&amp;#34;: {
    &amp;#34;resultType&amp;#34;: &amp;#34;matrix&amp;#34; | &amp;#34;streams&amp;#34;,
    &amp;#34;result&amp;#34;: [&amp;lt;matrix value&amp;gt;] | [&amp;lt;stream value&amp;gt;]
    &amp;#34;stats&amp;#34; : [&amp;lt;statistics&amp;gt;]
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Where &lt;code&gt;&amp;lt;matrix value&amp;gt;&lt;/code&gt; is:&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;{
  &amp;#34;metric&amp;#34;: {
    &amp;lt;label key-value pairs&amp;gt;
  },
  &amp;#34;values&amp;#34;: [
    [
      &amp;lt;number: second unix epoch&amp;gt;,
      &amp;lt;string: value&amp;gt;
    ],
    ...
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The items in the &lt;code&gt;values&lt;/code&gt; array are sorted by timestamp, and the oldest item is first.&lt;/p&gt;
&lt;p&gt;And &lt;code&gt;&amp;lt;stream value&amp;gt;&lt;/code&gt; is:&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;{
  &amp;#34;stream&amp;#34;: {
    &amp;lt;label key-value pairs&amp;gt;
  },
  &amp;#34;values&amp;#34;: [
    [
      &amp;lt;string: nanosecond unix epoch&amp;gt;,
      &amp;lt;string: log line&amp;gt;
    ],
    ...
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The items in the &lt;code&gt;values&lt;/code&gt; array are sorted by timestamp.
The most recent item is first when using &lt;code&gt;direction=backward&lt;/code&gt;.
The oldest item is first when using &lt;code&gt;direction=forward&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;See &lt;a href=&#34;#statistics&#34;&gt;statistics&lt;/a&gt; for information about the statistics returned by Loki.&lt;/p&gt;
&lt;h3 id=&#34;examples-1&#34;&gt;Examples&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;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ curl -G -s  &amp;#34;http://localhost:3100/loki/api/v1/query_range&amp;#34; --data-urlencode &amp;#39;query=sum(rate({job=&amp;#34;varlogs&amp;#34;}[10m])) by (level)&amp;#39; --data-urlencode &amp;#39;step=300&amp;#39; | jq
{
  &amp;#34;status&amp;#34;: &amp;#34;success&amp;#34;,
  &amp;#34;data&amp;#34;: {
    &amp;#34;resultType&amp;#34;: &amp;#34;matrix&amp;#34;,
    &amp;#34;result&amp;#34;: [
      {
       &amp;#34;metric&amp;#34;: {
          &amp;#34;level&amp;#34;: &amp;#34;info&amp;#34;
        },
        &amp;#34;values&amp;#34;: [
          [
            1588889221,
            &amp;#34;137.95&amp;#34;
          ],
          [
            1588889221,
            &amp;#34;467.115&amp;#34;
          ],
          [
            1588889221,
            &amp;#34;658.8516666666667&amp;#34;
          ]
        ]
      },
      {
        &amp;#34;metric&amp;#34;: {
          &amp;#34;level&amp;#34;: &amp;#34;warn&amp;#34;
        },
        &amp;#34;values&amp;#34;: [
          [
            1588889221,
            &amp;#34;137.27833333333334&amp;#34;
          ],
          [
            1588889221,
            &amp;#34;467.69&amp;#34;
          ],
          [
            1588889221,
            &amp;#34;660.6933333333334&amp;#34;
          ]
        ]
      }
    ],
    &amp;#34;stats&amp;#34;: {
      ...
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ curl -G -s  &amp;#34;http://localhost:3100/loki/api/v1/query_range&amp;#34; --data-urlencode &amp;#39;query={job=&amp;#34;varlogs&amp;#34;}&amp;#39; | jq
{
  &amp;#34;status&amp;#34;: &amp;#34;success&amp;#34;,
  &amp;#34;data&amp;#34;: {
    &amp;#34;resultType&amp;#34;: &amp;#34;streams&amp;#34;,
    &amp;#34;result&amp;#34;: [
      {
        &amp;#34;stream&amp;#34;: {
          &amp;#34;filename&amp;#34;: &amp;#34;/var/log/myproject.log&amp;#34;,
          &amp;#34;job&amp;#34;: &amp;#34;varlogs&amp;#34;,
          &amp;#34;level&amp;#34;: &amp;#34;info&amp;#34;
        },
        &amp;#34;values&amp;#34;: [
          [
            &amp;#34;1569266497240578000&amp;#34;,
            &amp;#34;foo&amp;#34;
          ],
          [
            &amp;#34;1569266492548155000&amp;#34;,
            &amp;#34;bar&amp;#34;
          ]
        ]
      }
    ],
    &amp;#34;stats&amp;#34;: {
      ...
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;list-labels-within-a-range-of-time&#34;&gt;List labels within a range of time&lt;/h2&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;GET /loki/api/v1/labels&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/loki/api/v1/labels&lt;/code&gt; retrieves the list of known labels within a given time span.
Loki may use a larger time span than the one specified.
It accepts the following query parameters in the URL:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;start&lt;/code&gt;: The start time for the query as a nanosecond Unix epoch. Defaults to 6 hours ago.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;end&lt;/code&gt;: The end time for the query as a nanosecond Unix epoch. Defaults to now.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In microservices mode, &lt;code&gt;/loki/api/v1/labels&lt;/code&gt; is exposed by the querier.&lt;/p&gt;
&lt;p&gt;Response:&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;{
  &amp;#34;status&amp;#34;: &amp;#34;success&amp;#34;,
  &amp;#34;data&amp;#34;: [
    &amp;lt;label string&amp;gt;,
    ...
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;examples-2&#34;&gt;Examples&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;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ curl -G -s  &amp;#34;http://localhost:3100/loki/api/v1/labels&amp;#34; | jq
{
  &amp;#34;status&amp;#34;: &amp;#34;success&amp;#34;,
  &amp;#34;data&amp;#34;: [
    &amp;#34;foo&amp;#34;,
    &amp;#34;bar&amp;#34;,
    &amp;#34;baz&amp;#34;
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;list-label-values-within-a-range-of-time&#34;&gt;List label values within a range of time&lt;/h2&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;GET /loki/api/v1/label/&amp;lt;name&amp;gt;/values&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/loki/api/v1/label/&amp;lt;name&amp;gt;/values&lt;/code&gt; retrieves the list of known values for a given
label within a given time span. Loki may use a larger time span than the one specified.
It accepts the following query parameters in the URL:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;start&lt;/code&gt;: The start time for the query as a nanosecond Unix epoch. Defaults to 6 hours ago.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;end&lt;/code&gt;: The end time for the query as a nanosecond Unix epoch. Defaults to now.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In microservices mode, &lt;code&gt;/loki/api/v1/label/&amp;lt;name&amp;gt;/values&lt;/code&gt; is exposed by the querier.&lt;/p&gt;
&lt;p&gt;Response:&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;{
  &amp;#34;status&amp;#34;: &amp;#34;success&amp;#34;,
  &amp;#34;data&amp;#34;: [
    &amp;lt;label value&amp;gt;,
    ...
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;examples-3&#34;&gt;Examples&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;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ curl -G -s  &amp;#34;http://localhost:3100/loki/api/v1/label/foo/values&amp;#34; | jq
{
  &amp;#34;status&amp;#34;: &amp;#34;success&amp;#34;,
  &amp;#34;data&amp;#34;: [
    &amp;#34;cat&amp;#34;,
    &amp;#34;dog&amp;#34;,
    &amp;#34;axolotl&amp;#34;
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;stream-log-messages&#34;&gt;Stream log messages&lt;/h2&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;GET /loki/api/v1/tail&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/loki/api/v1/tail&lt;/code&gt; is a WebSocket endpoint that will stream log messages based on
a query. It accepts the following query parameters in the URL:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;query&lt;/code&gt;: The &lt;a href=&#34;../logql/&#34;&gt;LogQL&lt;/a&gt; query to perform&lt;/li&gt;
&lt;li&gt;&lt;code&gt;delay_for&lt;/code&gt;: The number of seconds to delay retrieving logs to let slow
loggers catch up. Defaults to 0 and cannot be larger than 5.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;limit&lt;/code&gt;: The max number of entries to return. It defaults to &lt;code&gt;100&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;start&lt;/code&gt;: The start time for the query as a nanosecond Unix epoch. Defaults to one hour ago.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In microservices mode, &lt;code&gt;/loki/api/v1/tail&lt;/code&gt; is exposed by the querier.&lt;/p&gt;
&lt;p&gt;Response (streamed):&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;{
  &amp;#34;streams&amp;#34;: [
    {
      &amp;#34;stream&amp;#34;: {
        &amp;lt;label key-value pairs&amp;gt;
      },
      &amp;#34;values&amp;#34;: [
        [
          &amp;lt;string: nanosecond unix epoch&amp;gt;,
          &amp;lt;string: log line&amp;gt;
        ]
      ]
    }
  ],
  &amp;#34;dropped_entries&amp;#34;: [
    {
      &amp;#34;labels&amp;#34;: {
        &amp;lt;label key-value pairs&amp;gt;
      },
      &amp;#34;timestamp&amp;#34;: &amp;#34;&amp;lt;nanosecond unix epoch&amp;gt;&amp;#34;
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;push-log-entries-to-loki&#34;&gt;Push log entries to Loki&lt;/h2&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;POST /loki/api/v1/push&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/loki/api/v1/push&lt;/code&gt; is the endpoint used to send log entries to Loki. The default
behavior is for the POST body to be a snappy-compressed protobuf message:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/loki/blob/main/pkg/logproto/logproto.proto&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Protobuf definition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/loki/blob/main/clients/pkg/promtail/client/client.go&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go client library&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Alternatively, if the &lt;code&gt;Content-Type&lt;/code&gt; header is set to &lt;code&gt;application/json&lt;/code&gt;, a
JSON post body can be sent in the following format:&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;{
  &amp;#34;streams&amp;#34;: [
    {
      &amp;#34;stream&amp;#34;: {
        &amp;#34;label&amp;#34;: &amp;#34;value&amp;#34;
      },
      &amp;#34;values&amp;#34;: [
          [ &amp;#34;&amp;lt;unix epoch in nanoseconds&amp;gt;&amp;#34;, &amp;#34;&amp;lt;log line&amp;gt;&amp;#34; ],
          [ &amp;#34;&amp;lt;unix epoch in nanoseconds&amp;gt;&amp;#34;, &amp;#34;&amp;lt;log line&amp;gt;&amp;#34; ]
      ]
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can set &lt;code&gt;Content-Encoding: gzip&lt;/code&gt; request header and post gzipped JSON.&lt;/p&gt;
&lt;p&gt;Loki can be configured to &lt;a href=&#34;../configuration/#accept-out-of-order-writes&#34;&gt;accept out-of-order writes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In microservices mode, &lt;code&gt;/loki/api/v1/push&lt;/code&gt; is exposed by the distributor.&lt;/p&gt;
&lt;h3 id=&#34;examples-4&#34;&gt;Examples&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;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ curl -v -H &amp;#34;Content-Type: application/json&amp;#34; -XPOST -s &amp;#34;http://localhost:3100/loki/api/v1/push&amp;#34; --data-raw \
  &amp;#39;{&amp;#34;streams&amp;#34;: [{ &amp;#34;stream&amp;#34;: { &amp;#34;foo&amp;#34;: &amp;#34;bar2&amp;#34; }, &amp;#34;values&amp;#34;: [ [ &amp;#34;1570818238000000000&amp;#34;, &amp;#34;fizzbuzz&amp;#34; ] ] }]}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;identify-ready-loki-instance&#34;&gt;Identify ready Loki instance&lt;/h2&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;GET /ready&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/ready&lt;/code&gt; returns HTTP 200 when the Loki instance is ready to accept traffic. If
running Loki on Kubernetes, &lt;code&gt;/ready&lt;/code&gt; can be used as a readiness probe.&lt;/p&gt;
&lt;p&gt;In microservices mode, the &lt;code&gt;/ready&lt;/code&gt; endpoint is exposed by all components.&lt;/p&gt;
&lt;h2 id=&#34;flush-in-memory-chunks-to-backing-store&#34;&gt;Flush in-memory chunks to backing store&lt;/h2&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;POST /flush&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/flush&lt;/code&gt; triggers a flush of all in-memory chunks held by the ingesters to the
backing store. Mainly used for local testing.&lt;/p&gt;
&lt;p&gt;In microservices mode, the &lt;code&gt;/flush&lt;/code&gt; endpoint is exposed by the ingester.&lt;/p&gt;
&lt;h2 id=&#34;flush-in-memory-chunks-and-shut-down&#34;&gt;Flush in-memory chunks and shut down&lt;/h2&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;POST /ingester/shutdown&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/ingester/shutdown&lt;/code&gt; triggers a shutdown of the ingester and notably will &lt;em&gt;always&lt;/em&gt; flush any in memory chunks it holds.
This is helpful for scaling down WAL-enabled ingesters where we want to ensure old WAL directories are not orphaned,
but instead flushed to our chunk backend.&lt;/p&gt;
&lt;p&gt;It accepts three URL query parameters &lt;code&gt;flush&lt;/code&gt;, &lt;code&gt;delete_ring_tokens&lt;/code&gt;, and &lt;code&gt;terminate&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;URL query parameters:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;flush=&amp;lt;bool&amp;gt;&lt;/code&gt;:
Flag to control whether to flush any in-memory chunks the ingester holds. Defaults to &lt;code&gt;true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;delete_ring_tokens=&amp;lt;bool&amp;gt;&lt;/code&gt;:
Flag to control whether to delete the file that contains the ingester ring tokens of the instance if the &lt;code&gt;-ingester.token-file-path&lt;/code&gt; is specified.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;terminate=&amp;lt;bool&amp;gt;&lt;/code&gt;:
Flag to control whether to terminate the Loki process after service shutdown. Defaults to &lt;code&gt;true&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This handler, in contrast to the deprecated &lt;code&gt;/ingester/flush_shutdown&lt;/code&gt; handler, terminates the Loki process by default.
This behaviour can be changed by setting the &lt;code&gt;terminate&lt;/code&gt; query parameter to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In microservices mode, the &lt;code&gt;/ingester/shutdown&lt;/code&gt; endpoint is exposed by the ingester.&lt;/p&gt;
&lt;h2 id=&#34;display-distributor-consistent-hash-ring-status&#34;&gt;Display distributor consistent hash ring status&lt;/h2&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;GET /distributor/ring&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Displays a web page with the distributor hash ring status, including the state, healthy and last heartbeat time of each distributor.&lt;/p&gt;
&lt;h2 id=&#34;return-exposed-prometheus-metrics&#34;&gt;Return exposed Prometheus metrics&lt;/h2&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;GET /metrics&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/metrics&lt;/code&gt; returns exposed Prometheus metrics. See
&lt;a href=&#34;../operations/observability/&#34;&gt;Observing Loki&lt;/a&gt;
for a list of exported metrics.&lt;/p&gt;
&lt;p&gt;In microservices mode, the &lt;code&gt;/metrics&lt;/code&gt; endpoint is exposed by all components.&lt;/p&gt;
&lt;h2 id=&#34;list-current-configuration&#34;&gt;List current configuration&lt;/h2&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;GET /config&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/config&lt;/code&gt; exposes the current configuration. The optional &lt;code&gt;mode&lt;/code&gt; query parameter can be used to
modify the output. If it has the value &lt;code&gt;diff&lt;/code&gt; only the differences between the default configuration
and the current are returned. A value of &lt;code&gt;defaults&lt;/code&gt; returns the default configuration.&lt;/p&gt;
&lt;p&gt;In microservices mode, the &lt;code&gt;/config&lt;/code&gt; endpoint is exposed by all components.&lt;/p&gt;
&lt;h2 id=&#34;list-running-services&#34;&gt;List running services&lt;/h2&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;GET /services&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/services&lt;/code&gt; returns a list of all running services and their current states.&lt;/p&gt;
&lt;p&gt;Services can have the following states:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;New&lt;/strong&gt;: Service is new, not running yet (initial state)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Starting&lt;/strong&gt;: Service is starting; if starting succeeds, service enters &lt;strong&gt;Running&lt;/strong&gt; state&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Running&lt;/strong&gt;: Service is fully running now; when service stops running, it enters &lt;strong&gt;Stopping&lt;/strong&gt; state&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stopping&lt;/strong&gt;: Service is shutting down&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Terminated&lt;/strong&gt;: Service has stopped successfully (terminal state)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Failed&lt;/strong&gt;: Service has failed in &lt;strong&gt;Starting&lt;/strong&gt;, &lt;strong&gt;Running&lt;/strong&gt; or &lt;strong&gt;Stopping&lt;/strong&gt; state (terminal state)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;list-build-information&#34;&gt;List build information&lt;/h2&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;GET /loki/api/v1/status/buildinfo&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;/loki/api/v1/status/buildinfo&lt;/code&gt; exposes the build information in a JSON object. The fields are &lt;code&gt;version&lt;/code&gt;, &lt;code&gt;revision&lt;/code&gt;, &lt;code&gt;branch&lt;/code&gt;, &lt;code&gt;buildDate&lt;/code&gt;, &lt;code&gt;buildUser&lt;/code&gt;, and &lt;code&gt;goVersion&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;list-series&#34;&gt;List series&lt;/h2&gt;
&lt;p&gt;The Series API is available under the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GET /loki/api/v1/series&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;POST /loki/api/v1/series&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GET /api/prom/series&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;POST /api/prom/series&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This endpoint returns the list of time series that match a certain label set.&lt;/p&gt;
&lt;p&gt;URL query parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;match[]=&amp;lt;series_selector&amp;gt;&lt;/code&gt;: Repeated log stream selector argument that selects the streams to return. At least one &lt;code&gt;match[]&lt;/code&gt; argument must be provided.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;start=&amp;lt;nanosecond Unix epoch&amp;gt;&lt;/code&gt;: Start timestamp.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;end=&amp;lt;nanosecond Unix epoch&amp;gt;&lt;/code&gt;: End timestamp.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can URL-encode these parameters directly in the request body by using the POST method and &lt;code&gt;Content-Type: application/x-www-form-urlencoded&lt;/code&gt; header. This is useful when specifying a large or dynamic number of stream selectors that may breach server-side URL character limits.&lt;/p&gt;
&lt;p&gt;In microservices mode, these endpoints are exposed by the querier.&lt;/p&gt;
&lt;h3 id=&#34;examples-5&#34;&gt;Examples&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;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ curl -s &amp;#34;http://localhost:3100/loki/api/v1/series&amp;#34; --data-urlencode &amp;#39;match[]={container_name=~&amp;#34;prometheus.*&amp;#34;, component=&amp;#34;server&amp;#34;}&amp;#39; --data-urlencode &amp;#39;match[]={app=&amp;#34;loki&amp;#34;}&amp;#39; | jq &amp;#39;.&amp;#39;
{
  &amp;#34;status&amp;#34;: &amp;#34;success&amp;#34;,
  &amp;#34;data&amp;#34;: [
    {
      &amp;#34;container_name&amp;#34;: &amp;#34;loki&amp;#34;,
      &amp;#34;app&amp;#34;: &amp;#34;loki&amp;#34;,
      &amp;#34;stream&amp;#34;: &amp;#34;stderr&amp;#34;,
      &amp;#34;filename&amp;#34;: &amp;#34;/var/log/pods/default_loki-stack-0_50835643-1df0-11ea-ba79-025000000001/loki/0.log&amp;#34;,
      &amp;#34;name&amp;#34;: &amp;#34;loki&amp;#34;,
      &amp;#34;job&amp;#34;: &amp;#34;default/loki&amp;#34;,
      &amp;#34;controller_revision_hash&amp;#34;: &amp;#34;loki-stack-757479754d&amp;#34;,
      &amp;#34;statefulset_kubernetes_io_pod_name&amp;#34;: &amp;#34;loki-stack-0&amp;#34;,
      &amp;#34;release&amp;#34;: &amp;#34;loki-stack&amp;#34;,
      &amp;#34;namespace&amp;#34;: &amp;#34;default&amp;#34;,
      &amp;#34;instance&amp;#34;: &amp;#34;loki-stack-0&amp;#34;
    },
    {
      &amp;#34;chart&amp;#34;: &amp;#34;prometheus-9.3.3&amp;#34;,
      &amp;#34;container_name&amp;#34;: &amp;#34;prometheus-server-configmap-reload&amp;#34;,
      &amp;#34;filename&amp;#34;: &amp;#34;/var/log/pods/default_loki-stack-prometheus-server-696cc9ddff-87lmq_507b1db4-1df0-11ea-ba79-025000000001/prometheus-server-configmap-reload/0.log&amp;#34;,
      &amp;#34;instance&amp;#34;: &amp;#34;loki-stack-prometheus-server-696cc9ddff-87lmq&amp;#34;,
      &amp;#34;pod_template_hash&amp;#34;: &amp;#34;696cc9ddff&amp;#34;,
      &amp;#34;app&amp;#34;: &amp;#34;prometheus&amp;#34;,
      &amp;#34;component&amp;#34;: &amp;#34;server&amp;#34;,
      &amp;#34;heritage&amp;#34;: &amp;#34;Tiller&amp;#34;,
      &amp;#34;job&amp;#34;: &amp;#34;default/prometheus&amp;#34;,
      &amp;#34;namespace&amp;#34;: &amp;#34;default&amp;#34;,
      &amp;#34;release&amp;#34;: &amp;#34;loki-stack&amp;#34;,
      &amp;#34;stream&amp;#34;: &amp;#34;stderr&amp;#34;
    },
    {
      &amp;#34;app&amp;#34;: &amp;#34;prometheus&amp;#34;,
      &amp;#34;component&amp;#34;: &amp;#34;server&amp;#34;,
      &amp;#34;filename&amp;#34;: &amp;#34;/var/log/pods/default_loki-stack-prometheus-server-696cc9ddff-87lmq_507b1db4-1df0-11ea-ba79-025000000001/prometheus-server/0.log&amp;#34;,
      &amp;#34;release&amp;#34;: &amp;#34;loki-stack&amp;#34;,
      &amp;#34;namespace&amp;#34;: &amp;#34;default&amp;#34;,
      &amp;#34;pod_template_hash&amp;#34;: &amp;#34;696cc9ddff&amp;#34;,
      &amp;#34;stream&amp;#34;: &amp;#34;stderr&amp;#34;,
      &amp;#34;chart&amp;#34;: &amp;#34;prometheus-9.3.3&amp;#34;,
      &amp;#34;container_name&amp;#34;: &amp;#34;prometheus-server&amp;#34;,
      &amp;#34;heritage&amp;#34;: &amp;#34;Tiller&amp;#34;,
      &amp;#34;instance&amp;#34;: &amp;#34;loki-stack-prometheus-server-696cc9ddff-87lmq&amp;#34;,
      &amp;#34;job&amp;#34;: &amp;#34;default/prometheus&amp;#34;
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;index-stats&#34;&gt;Index Stats&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;/loki/api/v1/index/stats&lt;/code&gt; endpoint can be used to query the index for the number of &lt;code&gt;streams&lt;/code&gt;, &lt;code&gt;chunks&lt;/code&gt;, &lt;code&gt;entries&lt;/code&gt;, and &lt;code&gt;bytes&lt;/code&gt; that a query resolves to.&lt;/p&gt;
&lt;p&gt;URL query parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;query&lt;/code&gt;: The &lt;a href=&#34;../logql/&#34;&gt;LogQL&lt;/a&gt; matchers to check (i.e. &lt;code&gt;{job=&amp;quot;foo&amp;quot;, env!=&amp;quot;dev&amp;quot;}&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;start=&amp;lt;nanosecond Unix epoch&amp;gt;&lt;/code&gt;: Start timestamp.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;end=&amp;lt;nanosecond Unix epoch&amp;gt;&lt;/code&gt;: End timestamp.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can URL-encode these parameters directly in the request body by using the POST method and &lt;code&gt;Content-Type: application/x-www-form-urlencoded&lt;/code&gt; header. This is useful when specifying a large or dynamic number of stream selectors that may breach server-side URL character limits.&lt;/p&gt;
&lt;p&gt;Response:&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;JSON&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-json&#34;&gt;{
  &amp;#34;streams&amp;#34;: 100,
  &amp;#34;chunks&amp;#34;: 1000,
  &amp;#34;entries&amp;#34;: 5000,
  &amp;#34;bytes&amp;#34;: 100000,
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;It is an approximation with the following caveats:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It does not include data from the ingesters&lt;/li&gt;
&lt;li&gt;It is a probabilistic technique&lt;/li&gt;
&lt;li&gt;streams/chunks which span multiple period configurations may be counted twice.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These make it generally more helpful for larger queries.
It can be used for better understanding the throughput requirements and data topology for a list of matchers over a period of time.&lt;/p&gt;
&lt;h2 id=&#34;statistics&#34;&gt;Statistics&lt;/h2&gt;
&lt;p&gt;Query endpoints such as &lt;code&gt;/api/prom/query&lt;/code&gt;, &lt;code&gt;/loki/api/v1/query&lt;/code&gt; and &lt;code&gt;/loki/api/v1/query_range&lt;/code&gt; return a set of statistics about the query execution. Those statistics allow users to understand the amount of data processed and at which speed.&lt;/p&gt;
&lt;p&gt;The example belows show all possible statistics returned with their respective description.&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;JSON&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-json&#34;&gt;{
  &amp;#34;status&amp;#34;: &amp;#34;success&amp;#34;,
  &amp;#34;data&amp;#34;: {
    &amp;#34;resultType&amp;#34;: &amp;#34;streams&amp;#34;,
    &amp;#34;result&amp;#34;: [],
    &amp;#34;stats&amp;#34;: {
     &amp;#34;ingester&amp;#34; : {
        &amp;#34;compressedBytes&amp;#34;: 0, // Total bytes of compressed chunks (blocks) processed by ingesters
        &amp;#34;decompressedBytes&amp;#34;: 0, // Total bytes decompressed and processed by ingesters
        &amp;#34;decompressedLines&amp;#34;: 0, // Total lines decompressed and processed by ingesters
        &amp;#34;headChunkBytes&amp;#34;: 0, // Total bytes read from ingesters head chunks
        &amp;#34;headChunkLines&amp;#34;: 0, // Total lines read from ingesters head chunks
        &amp;#34;totalBatches&amp;#34;: 0, // Total batches sent by ingesters
        &amp;#34;totalChunksMatched&amp;#34;: 0, // Total chunks matched by ingesters
        &amp;#34;totalDuplicates&amp;#34;: 0, // Total of duplicates found by ingesters
        &amp;#34;totalLinesSent&amp;#34;: 0, // Total lines sent by ingesters
        &amp;#34;totalReached&amp;#34;: 0 // Amount of ingesters reached.
      },
      &amp;#34;store&amp;#34;: {
        &amp;#34;compressedBytes&amp;#34;: 0, // Total bytes of compressed chunks (blocks) processed by the store
        &amp;#34;decompressedBytes&amp;#34;: 0,  // Total bytes decompressed and processed by the store
        &amp;#34;decompressedLines&amp;#34;: 0, // Total lines decompressed and processed by the store
        &amp;#34;chunksDownloadTime&amp;#34;: 0, // Total time spent downloading chunks in seconds (float)
        &amp;#34;totalChunksRef&amp;#34;: 0, // Total chunks found in the index for the current query
        &amp;#34;totalChunksDownloaded&amp;#34;: 0, // Total of chunks downloaded
        &amp;#34;totalDuplicates&amp;#34;: 0 // Total of duplicates removed from replication
      },
      &amp;#34;summary&amp;#34;: {
        &amp;#34;bytesProcessedPerSecond&amp;#34;: 0, // Total of bytes processed per second
        &amp;#34;execTime&amp;#34;: 0, // Total execution time in seconds (float)
        &amp;#34;linesProcessedPerSecond&amp;#34;: 0, // Total lines processed per second
        &amp;#34;queueTime&amp;#34;: 0, // Total queue time in seconds (float)
        &amp;#34;totalBytesProcessed&amp;#34;:0, // Total amount of bytes processed overall for this request
        &amp;#34;totalLinesProcessed&amp;#34;:0 // Total amount of lines processed overall for this request
      }
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;ruler&#34;&gt;Ruler&lt;/h2&gt;
&lt;p&gt;The ruler API endpoints require to configure a backend object storage to store the recording rules and alerts. The ruler API uses the concept of a &amp;ldquo;namespace&amp;rdquo; when creating rule groups. This is a stand-in for the name of the rule file in Prometheus. Rule groups must be named uniquely within a namespace.&lt;/p&gt;
&lt;h3 id=&#34;ruler-ring-status&#34;&gt;Ruler ring status&lt;/h3&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;GET /ruler/ring&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Displays a web page with the ruler hash ring status, including the state, healthy and last heartbeat time of each ruler.&lt;/p&gt;
&lt;h3 id=&#34;list-rule-groups&#34;&gt;List rule groups&lt;/h3&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;GET /loki/api/v1/rules&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;List all rules configured for the authenticated tenant. This endpoint returns a YAML dictionary with all the rule groups for each namespace and &lt;code&gt;200&lt;/code&gt; status code on success.&lt;/p&gt;
&lt;h4 id=&#34;example-response&#34;&gt;Example response&lt;/h4&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;---
&amp;lt;namespace1&amp;gt;:
- name: &amp;lt;string&amp;gt;
  interval: &amp;lt;duration;optional&amp;gt;
  rules:
  - alert: &amp;lt;string&amp;gt;
      expr: &amp;lt;string&amp;gt;
      for: &amp;lt;duration&amp;gt;
      annotations:
      &amp;lt;annotation_name&amp;gt;: &amp;lt;string&amp;gt;
      labels:
      &amp;lt;label_name&amp;gt;: &amp;lt;string&amp;gt;
- name: &amp;lt;string&amp;gt;
  interval: &amp;lt;duration;optional&amp;gt;
  rules:
  - alert: &amp;lt;string&amp;gt;
      expr: &amp;lt;string&amp;gt;
      for: &amp;lt;duration&amp;gt;
      annotations:
      &amp;lt;annotation_name&amp;gt;: &amp;lt;string&amp;gt;
      labels:
      &amp;lt;label_name&amp;gt;: &amp;lt;string&amp;gt;
&amp;lt;namespace2&amp;gt;:
- name: &amp;lt;string&amp;gt;
  interval: &amp;lt;duration;optional&amp;gt;
  rules:
  - alert: &amp;lt;string&amp;gt;
      expr: &amp;lt;string&amp;gt;
      for: &amp;lt;duration&amp;gt;
      annotations:
      &amp;lt;annotation_name&amp;gt;: &amp;lt;string&amp;gt;
      labels:
      &amp;lt;label_name&amp;gt;: &amp;lt;string&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;get-rule-groups-by-namespace&#34;&gt;Get rule groups by namespace&lt;/h3&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;GET /loki/api/v1/rules/{namespace}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Returns the rule groups defined for a given namespace.&lt;/p&gt;
&lt;h4 id=&#34;example-response-1&#34;&gt;Example response&lt;/h4&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: &amp;lt;string&amp;gt;
interval: &amp;lt;duration;optional&amp;gt;
rules:
  - alert: &amp;lt;string&amp;gt;
    expr: &amp;lt;string&amp;gt;
    for: &amp;lt;duration&amp;gt;
    annotations:
      &amp;lt;annotation_name&amp;gt;: &amp;lt;string&amp;gt;
    labels:
      &amp;lt;label_name&amp;gt;: &amp;lt;string&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;get-rule-group&#34;&gt;Get rule group&lt;/h3&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;GET /loki/api/v1/rules/{namespace}/{groupName}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Returns the rule group matching the request namespace and group name.&lt;/p&gt;
&lt;h3 id=&#34;set-rule-group&#34;&gt;Set rule group&lt;/h3&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;POST /loki/api/v1/rules/{namespace}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Creates or updates a rule group. This endpoint expects a request with &lt;code&gt;Content-Type: application/yaml&lt;/code&gt; header and the rules &lt;strong&gt;YAML&lt;/strong&gt; definition in the request body, and returns &lt;code&gt;202&lt;/code&gt; on success.&lt;/p&gt;
&lt;h4 id=&#34;example-request&#34;&gt;Example request&lt;/h4&gt;
&lt;p&gt;Request headers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Content-Type: application/yaml&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Request body:&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: &amp;lt;string&amp;gt;
interval: &amp;lt;duration;optional&amp;gt;
rules:
  - alert: &amp;lt;string&amp;gt;
    expr: &amp;lt;string&amp;gt;
    for: &amp;lt;duration&amp;gt;
    annotations:
      &amp;lt;annotation_name&amp;gt;: &amp;lt;string&amp;gt;
    labels:
      &amp;lt;label_name&amp;gt;: &amp;lt;string&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;delete-rule-group&#34;&gt;Delete rule group&lt;/h3&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;DELETE /loki/api/v1/rules/{namespace}/{groupName}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Deletes a rule group by namespace and group name. This endpoints returns &lt;code&gt;202&lt;/code&gt; on success.&lt;/p&gt;
&lt;h3 id=&#34;delete-namespace&#34;&gt;Delete namespace&lt;/h3&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;DELETE /loki/api/v1/rules/{namespace}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Deletes all the rule groups in a namespace (including the namespace itself). This endpoint returns &lt;code&gt;202&lt;/code&gt; on success.&lt;/p&gt;
&lt;h3 id=&#34;list-rules&#34;&gt;List rules&lt;/h3&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;GET /prometheus/api/v1/rules&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Prometheus-compatible rules endpoint to list alerting and recording rules that are currently loaded.&lt;/p&gt;
&lt;p&gt;For more information, refer to the &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/api/#rules&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus rules&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h3 id=&#34;list-alerts&#34;&gt;List alerts&lt;/h3&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;GET /prometheus/api/v1/alerts&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Prometheus-compatible rules endpoint to list all active alerts.&lt;/p&gt;
&lt;p&gt;For more information, refer to the Prometheus &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/api/#alerts&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;alerts&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h2 id=&#34;compactor&#34;&gt;Compactor&lt;/h2&gt;
&lt;h3 id=&#34;compactor-ring-status&#34;&gt;Compactor ring status&lt;/h3&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;GET /compactor/ring&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Displays a web page with the compactor hash ring status, including the state, health, and last heartbeat time of each compactor.&lt;/p&gt;
&lt;h3 id=&#34;request-log-deletion&#34;&gt;Request log deletion&lt;/h3&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;POST /loki/api/v1/delete
PUT /loki/api/v1/delete&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Create a new delete request for the authenticated tenant.
The &lt;a href=&#34;../operations/storage/logs-deletion/&#34;&gt;log entry deletion&lt;/a&gt; documentation has configuration details.&lt;/p&gt;
&lt;p&gt;Log entry deletion is supported &lt;em&gt;only&lt;/em&gt; when the BoltDB Shipper is configured for the index store.&lt;/p&gt;
&lt;p&gt;Query parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;query=&amp;lt;series_selector&amp;gt;&lt;/code&gt;: query argument that identifies the streams from which to delete with optional line filters.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;start=&amp;lt;rfc3339 | unix_timestamp&amp;gt;&lt;/code&gt;: A timestamp that identifies the start of the time window within which entries will be deleted. If not specified, defaults to 0, the Unix Epoch time.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;end=&amp;lt;rfc3339 | unix_timestamp&amp;gt;&lt;/code&gt;: A timestamp that identifies the end of the time window within which entries will be deleted. If not specified, defaults to the current time.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A 204 response indicates success.&lt;/p&gt;
&lt;p&gt;The query parameter can also include filter operations. For example &lt;code&gt;query={foo=&amp;quot;bar&amp;quot;} |= &amp;quot;other&amp;quot;&lt;/code&gt; will filter out lines that contain the string &amp;ldquo;other&amp;rdquo; for the streams matching the stream selector &lt;code&gt;{foo=&amp;quot;bar&amp;quot;}&lt;/code&gt;.&lt;/p&gt;
&lt;h4 id=&#34;examples-6&#34;&gt;Examples&lt;/h4&gt;
&lt;p&gt;URL encode the &lt;code&gt;query&lt;/code&gt; parameter. This sample form of a cURL command URL encodes &lt;code&gt;query={foo=&amp;quot;bar&amp;quot;}&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;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -g -X POST \
  &amp;#39;http://127.0.0.1:3100/loki/api/v1/delete?query={foo=&amp;#34;bar&amp;#34;}&amp;amp;start=1591616227&amp;amp;end=1591619692&amp;#39; \
  -H &amp;#39;X-Scope-OrgID: 1&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The same example deletion request for Grafana Enterprise Logs uses Basic Authentication and specifies the tenant name as a user; &lt;code&gt;Tenant1&lt;/code&gt; is the tenant name in this example. The password in this example is an access policy token that has been defined in the API_TOKEN environment variable. The token must be for an access policy with &lt;code&gt;logs:delete&lt;/code&gt; scope for the tenant specified in the user field:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -u &amp;#34;Tenant1:$API_TOKEN&amp;#34; \
  -g -X POST \
  &amp;#39;http://127.0.0.1:3100/loki/api/v1/delete?query={foo=&amp;#34;bar&amp;#34;}&amp;amp;start=1591616227&amp;amp;end=1591619692&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;list-log-deletion-requests&#34;&gt;List log deletion requests&lt;/h3&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;GET /loki/api/v1/delete&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;List the existing delete requests for the authenticated tenant.
The &lt;a href=&#34;../operations/storage/logs-deletion/&#34;&gt;log entry deletion&lt;/a&gt; documentation has configuration details.&lt;/p&gt;
&lt;p&gt;Log entry deletion is supported &lt;em&gt;only&lt;/em&gt; when the BoltDB Shipper is configured for the index store.&lt;/p&gt;
&lt;p&gt;List the existing delete requests using the following API:&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;GET /loki/api/v1/delete&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This endpoint returns both processed and unprocessed deletion requests. It does not list canceled requests, as those requests will have been removed from storage.&lt;/p&gt;
&lt;h4 id=&#34;examples-7&#34;&gt;Examples&lt;/h4&gt;
&lt;p&gt;Example cURL command:&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;curl -X GET \
  &amp;lt;compactor_addr&amp;gt;/loki/api/v1/delete \
  -H &amp;#39;X-Scope-OrgID: &amp;lt;orgid&amp;gt;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The same example deletion request for Grafana Enterprise Logs uses Basic Authentication and specifies the tenant name as a user; &lt;code&gt;Tenant1&lt;/code&gt; is the tenant name in this example. The password in this example is an access policy token that has been defined in the API_TOKEN environment variable. The token must be for an access policy with &lt;code&gt;logs:delete&lt;/code&gt; scope for the tenant specified in the user field.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -u &amp;#34;Tenant1:$API_TOKEN&amp;#34; \
  -X GET \
  &amp;lt;compactor_addr&amp;gt;/loki/api/v1/delete&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;request-cancellation-of-a-delete-request&#34;&gt;Request cancellation of a delete request&lt;/h3&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;DELETE /loki/api/v1/delete&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Remove a delete request for the authenticated tenant.
The &lt;a href=&#34;../operations/storage/logs-deletion/&#34;&gt;log entry deletion&lt;/a&gt; documentation has configuration details.&lt;/p&gt;
&lt;p&gt;Loki allows cancellation of delete requests until the requests are picked up for processing. It is controlled by the &lt;code&gt;delete_request_cancel_period&lt;/code&gt; YAML configuration or the equivalent command line option when invoking Loki.&lt;/p&gt;
&lt;p&gt;Log entry deletion is supported &lt;em&gt;only&lt;/em&gt; when the BoltDB Shipper is configured for the index store.&lt;/p&gt;
&lt;p&gt;Cancel a delete request using this compactor endpoint:&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;DELETE /loki/api/v1/delete&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Query parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;request_id=&amp;lt;request_id&amp;gt;&lt;/code&gt;: Identifies the delete request to cancel; IDs are found using the &lt;code&gt;delete&lt;/code&gt; endpoint.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A 204 response indicates success.&lt;/p&gt;
&lt;h4 id=&#34;examples-8&#34;&gt;Examples&lt;/h4&gt;
&lt;p&gt;Example cURL command:&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;curl -X DELETE \
  &amp;#39;&amp;lt;compactor_addr&amp;gt;/loki/api/v1/delete?request_id=&amp;lt;request_id&amp;gt;&amp;#39; \
  -H &amp;#39;X-Scope-OrgID: &amp;lt;tenant-id&amp;gt;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The same example deletion cancellation request for Grafana Enterprise Logs uses Basic Authentication and specifies the tenant name as a user; &lt;code&gt;Tenant1&lt;/code&gt; is the tenant name in this example. The password in this example is an access policy token that has been defined in the API_TOKEN environment variable. The token must be for an access policy with &lt;code&gt;logs:delete&lt;/code&gt; scope for the tenant specified in the user field.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -u &amp;#34;Tenant1:$API_TOKEN&amp;#34; \
  -X DELETE \
  &amp;#39;&amp;lt;compactor_addr&amp;gt;/loki/api/v1/delete?request_id=&amp;lt;request_id&amp;gt;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;deprecated-endpoints&#34;&gt;Deprecated endpoints&lt;/h2&gt;
&lt;h3 id=&#34;get-apipromtail&#34;&gt;&lt;code&gt;GET /api/prom/tail&lt;/code&gt;&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;DEPRECATED&lt;/strong&gt;: &lt;code&gt;/api/prom/tail&lt;/code&gt; is deprecated. Use &lt;code&gt;/loki/api/v1/tail&lt;/code&gt;
instead.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;/api/prom/tail&lt;/code&gt; is a WebSocket endpoint that will stream log messages based on
a query. It accepts the following query parameters in the URL:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;query&lt;/code&gt;: The &lt;a href=&#34;../logql/&#34;&gt;LogQL&lt;/a&gt; query to perform&lt;/li&gt;
&lt;li&gt;&lt;code&gt;delay_for&lt;/code&gt;: The number of seconds to delay retrieving logs to let slow
loggers catch up. Defaults to 0 and cannot be larger than 5.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;limit&lt;/code&gt;: The max number of entries to return&lt;/li&gt;
&lt;li&gt;&lt;code&gt;start&lt;/code&gt;: The start time for the query as a nanosecond Unix epoch. Defaults to one hour ago.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In microservices mode, &lt;code&gt;/api/prom/tail&lt;/code&gt; is exposed by the querier.&lt;/p&gt;
&lt;p&gt;Response (streamed):&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;JSON&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-json&#34;&gt;{
  &amp;#34;streams&amp;#34;: [
    {
      &amp;#34;labels&amp;#34;: &amp;#34;&amp;lt;LogQL label key-value pairs&amp;gt;&amp;#34;,
      &amp;#34;entries&amp;#34;: [
        {
          &amp;#34;ts&amp;#34;: &amp;#34;&amp;lt;RFC3339Nano timestamp&amp;gt;&amp;#34;,
          &amp;#34;line&amp;#34;: &amp;#34;&amp;lt;log line&amp;gt;&amp;#34;
        }
      ]
    }
  ],
  &amp;#34;dropped_entries&amp;#34;: [
    {
      &amp;#34;Timestamp&amp;#34;: &amp;#34;&amp;lt;RFC3339Nano timestamp&amp;gt;&amp;#34;,
      &amp;#34;Labels&amp;#34;: &amp;#34;&amp;lt;LogQL label key-value pairs&amp;gt;&amp;#34;
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;dropped_entries&lt;/code&gt; will be populated when the tailer could not keep up with the
amount of traffic in Loki. When present, it indicates that the entries received
in the streams is not the full amount of logs that are present in Loki. Note
that the keys in &lt;code&gt;dropped_entries&lt;/code&gt; will be sent as uppercase &lt;code&gt;Timestamp&lt;/code&gt;
and &lt;code&gt;Labels&lt;/code&gt; instead of &lt;code&gt;labels&lt;/code&gt; and &lt;code&gt;ts&lt;/code&gt; like in the entries for the stream.&lt;/p&gt;
&lt;p&gt;As the response is streamed, the object defined by the response format above
will be sent over the WebSocket multiple times.&lt;/p&gt;
&lt;h3 id=&#34;get-apipromquery&#34;&gt;&lt;code&gt;GET /api/prom/query&lt;/code&gt;&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;WARNING&lt;/strong&gt;: &lt;code&gt;/api/prom/query&lt;/code&gt; is DEPRECATED; use &lt;code&gt;/loki/api/v1/query_range&lt;/code&gt;
instead.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;/api/prom/query&lt;/code&gt; supports doing general queries. The URL query parameters
support the following values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;query&lt;/code&gt;: The &lt;a href=&#34;../logql/&#34;&gt;LogQL&lt;/a&gt; query to perform&lt;/li&gt;
&lt;li&gt;&lt;code&gt;limit&lt;/code&gt;: The max number of entries to return&lt;/li&gt;
&lt;li&gt;&lt;code&gt;start&lt;/code&gt;: The start time for the query as a nanosecond Unix epoch. Defaults to one hour ago.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;end&lt;/code&gt;: The end time for the query as a nanosecond Unix epoch. Defaults to now.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;direction&lt;/code&gt;: Determines the sort order of logs. Supported values are &lt;code&gt;forward&lt;/code&gt; or &lt;code&gt;backward&lt;/code&gt;. Defaults to &lt;code&gt;backward.&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;regexp&lt;/code&gt;: a regex to filter the returned results&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In microservices mode, &lt;code&gt;/api/prom/query&lt;/code&gt; is exposed by the querier and the frontend.&lt;/p&gt;
&lt;p&gt;Note that the larger the time span between &lt;code&gt;start&lt;/code&gt; and &lt;code&gt;end&lt;/code&gt; will cause
additional load on Loki and the index store, resulting in slower queries.&lt;/p&gt;
&lt;p&gt;Response:&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;{
  &amp;#34;streams&amp;#34;: [
    {
      &amp;#34;labels&amp;#34;: &amp;#34;&amp;lt;LogQL label key-value pairs&amp;gt;&amp;#34;,
      &amp;#34;entries&amp;#34;: [
        {
          &amp;#34;ts&amp;#34;: &amp;#34;&amp;lt;RFC3339Nano string&amp;gt;&amp;#34;,
          &amp;#34;line&amp;#34;: &amp;#34;&amp;lt;log line&amp;gt;&amp;#34;
        },
        ...
      ],
    },
    ...
  ],
  &amp;#34;stats&amp;#34;: [&amp;lt;statistics&amp;gt;]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;See &lt;a href=&#34;#statistics&#34;&gt;statistics&lt;/a&gt; for information about the statistics returned by Loki.&lt;/p&gt;
&lt;h4 id=&#34;examples-9&#34;&gt;Examples&lt;/h4&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ curl -G -s &amp;#34;http://localhost:3100/api/prom/query&amp;#34; --data-urlencode &amp;#39;query={foo=&amp;#34;bar&amp;#34;}&amp;#39; | jq
{
  &amp;#34;streams&amp;#34;: [
    {
      &amp;#34;labels&amp;#34;: &amp;#34;{filename=\&amp;#34;/var/log/myproject.log\&amp;#34;, job=\&amp;#34;varlogs\&amp;#34;, level=\&amp;#34;info\&amp;#34;}&amp;#34;,
      &amp;#34;entries&amp;#34;: [
        {
          &amp;#34;ts&amp;#34;: &amp;#34;2019-06-06T19:25:41.972739Z&amp;#34;,
          &amp;#34;line&amp;#34;: &amp;#34;foo&amp;#34;
        },
        {
          &amp;#34;ts&amp;#34;: &amp;#34;2019-06-06T19:25:41.972722Z&amp;#34;,
          &amp;#34;line&amp;#34;: &amp;#34;bar&amp;#34;
        }
      ]
    }
  ],
  &amp;#34;stats&amp;#34;: {
    ...
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;get-apipromlabelnamevalues&#34;&gt;&lt;code&gt;GET /api/prom/label/&amp;lt;name&amp;gt;/values&lt;/code&gt;&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;WARNING&lt;/strong&gt;: &lt;code&gt;/api/prom/label/&amp;lt;name&amp;gt;/values&lt;/code&gt; is DEPRECATED; use &lt;code&gt;/loki/api/v1/label/&amp;lt;name&amp;gt;/values&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;/api/prom/label/&amp;lt;name&amp;gt;/values&lt;/code&gt; retrieves the list of known values for a given
label within a given time span. It accepts the following query parameters in
the URL:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;start&lt;/code&gt;: The start time for the query as a nanosecond Unix epoch. Defaults to 6 hours ago.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;end&lt;/code&gt;: The end time for the query as a nanosecond Unix epoch. Defaults to now.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In microservices mode, &lt;code&gt;/api/prom/label/&amp;lt;name&amp;gt;/values&lt;/code&gt; is exposed by the querier.&lt;/p&gt;
&lt;p&gt;Response:&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;{
  &amp;#34;values&amp;#34;: [
    &amp;lt;label value&amp;gt;,
    ...
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;examples-10&#34;&gt;Examples&lt;/h4&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ curl -G -s  &amp;#34;http://localhost:3100/api/prom/label/foo/values&amp;#34; | jq
{
  &amp;#34;values&amp;#34;: [
    &amp;#34;cat&amp;#34;,
    &amp;#34;dog&amp;#34;,
    &amp;#34;axolotl&amp;#34;
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;get-apipromlabel&#34;&gt;&lt;code&gt;GET /api/prom/label&lt;/code&gt;&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;WARNING&lt;/strong&gt;: &lt;code&gt;/api/prom/label&lt;/code&gt; is DEPRECATED; use &lt;code&gt;/loki/api/v1/label&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;/api/prom/label&lt;/code&gt; retrieves the list of known labels within a given time span. It
accepts the following query parameters in the URL:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;start&lt;/code&gt;: The start time for the query as a nanosecond Unix epoch. Defaults to 6 hours ago.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;end&lt;/code&gt;: The end time for the query as a nanosecond Unix epoch. Defaults to now.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In microservices mode, &lt;code&gt;/api/prom/label&lt;/code&gt; is exposed by the querier.&lt;/p&gt;
&lt;p&gt;Response:&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;{
  &amp;#34;values&amp;#34;: [
    &amp;lt;label string&amp;gt;,
    ...
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;examples-11&#34;&gt;Examples&lt;/h4&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ curl -G -s  &amp;#34;http://localhost:3100/api/prom/label&amp;#34; | jq
{
  &amp;#34;values&amp;#34;: [
    &amp;#34;foo&amp;#34;,
    &amp;#34;bar&amp;#34;,
    &amp;#34;baz&amp;#34;
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;post-apiprompush&#34;&gt;&lt;code&gt;POST /api/prom/push&lt;/code&gt;&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;WARNING&lt;/strong&gt;: &lt;code&gt;/api/prom/push&lt;/code&gt; is DEPRECATED; use &lt;code&gt;/loki/api/v1/push&lt;/code&gt;
instead.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;/api/prom/push&lt;/code&gt; is the endpoint used to send log entries to Loki. The default
behavior is for the POST body to be a snappy-compressed protobuf message:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/loki/tree/master/pkg/logproto/logproto.proto&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Protobuf definition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/loki/tree/master/pkg/promtail/client/client.go&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go client library&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Alternatively, if the &lt;code&gt;Content-Type&lt;/code&gt; header is set to &lt;code&gt;application/json&lt;/code&gt;, a
JSON post body can be sent in the following format:&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;{
  &amp;#34;streams&amp;#34;: [
    {
      &amp;#34;labels&amp;#34;: &amp;#34;&amp;lt;LogQL label key-value pairs&amp;gt;&amp;#34;,
      &amp;#34;entries&amp;#34;: [
        {
          &amp;#34;ts&amp;#34;: &amp;#34;&amp;lt;RFC3339Nano string&amp;gt;&amp;#34;,
          &amp;#34;line&amp;#34;: &amp;#34;&amp;lt;log line&amp;gt;&amp;#34;
        }
      ]
    }
  ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Loki can be configured to &lt;a href=&#34;../configuration/#accept-out-of-order-writes&#34;&gt;accept out-of-order writes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In microservices mode, &lt;code&gt;/api/prom/push&lt;/code&gt; is exposed by the distributor.&lt;/p&gt;
&lt;h4 id=&#34;examples-12&#34;&gt;Examples&lt;/h4&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ curl -H &amp;#34;Content-Type: application/json&amp;#34; -XPOST -s &amp;#34;https://localhost:3100/api/prom/push&amp;#34; --data-raw \
  &amp;#39;{&amp;#34;streams&amp;#34;: [{ &amp;#34;labels&amp;#34;: &amp;#34;{foo=\&amp;#34;bar\&amp;#34;}&amp;#34;, &amp;#34;entries&amp;#34;: [{ &amp;#34;ts&amp;#34;: &amp;#34;2018-12-18T08:28:06.801064-04:00&amp;#34;, &amp;#34;line&amp;#34;: &amp;#34;fizzbuzz&amp;#34; }] }]}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;post-ingesterflush_shutdown&#34;&gt;&lt;code&gt;POST /ingester/flush_shutdown&lt;/code&gt;&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;WARNING&lt;/strong&gt;: &lt;code&gt;/ingester/flush_shutdown&lt;/code&gt; is DEPRECATED; use &lt;code&gt;/ingester/shutdown?flush=true&lt;/code&gt;
instead.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;/ingester/flush_shutdown&lt;/code&gt; triggers a shutdown of the ingester and notably will &lt;em&gt;always&lt;/em&gt; flush any in memory chunks it holds.
This is helpful for scaling down WAL-enabled ingesters where we want to ensure old WAL directories are not orphaned,
but instead flushed to our chunk backend.&lt;/p&gt;
&lt;p&gt;In microservices mode, the &lt;code&gt;/ingester/flush_shutdown&lt;/code&gt; endpoint is exposed by the ingester.&lt;/p&gt;
]]></content><description>&lt;h1 id="grafana-loki-http-api">Grafana Loki HTTP API&lt;/h1>
&lt;p>Grafana Loki exposes an HTTP API for pushing, querying, and tailing log data.
Note that authenticating against the API is
out of scope for Loki.&lt;/p></description></item><item><title>Storage</title><link>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/storage/</link><pubDate>Mon, 14 Apr 2025 21:05:47 +0000</pubDate><guid>https://grafana.com/docs/enterprise-logs/v1.9.x/loki/storage/</guid><content><![CDATA[&lt;h1 id=&#34;storage&#34;&gt;Storage&lt;/h1&gt;
&lt;p&gt;Unlike other logging systems, Grafana Loki is built around the idea of only indexing
metadata about your logs: labels (just like Prometheus labels). Log data itself
is then compressed and stored in chunks in object stores such as S3 or GCS, or
even locally on the filesystem. A small index and highly compressed chunks
simplifies the operation and significantly lowers the cost of Loki.&lt;/p&gt;
&lt;p&gt;Until Loki 2.0, index data was stored in a separate index.&lt;/p&gt;
&lt;p&gt;Loki 2.0 brings an index mechanism named &amp;lsquo;boltdb-shipper&amp;rsquo; and is what we now call Single Store Loki.
This index type only requires one store, the object store, for both the index and chunks.
More detailed information can be found on the &lt;a href=&#34;/docs/enterprise-logs/v1.9.x/loki/operations/storage/boltdb-shipper/&#34;&gt;operations page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Some more storage details can also be found in the &lt;a href=&#34;/docs/enterprise-logs/v1.9.x/loki/operations/storage/&#34;&gt;operations section&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;implementations---chunks&#34;&gt;Implementations - Chunks&lt;/h2&gt;
&lt;h3 id=&#34;cassandra&#34;&gt;Cassandra&lt;/h3&gt;
&lt;p&gt;Cassandra is a popular database and one of Loki&amp;rsquo;s possible chunk stores and is production safe.&lt;/p&gt;
&lt;h3 id=&#34;gcs&#34;&gt;GCS&lt;/h3&gt;
&lt;p&gt;GCS is a hosted object store offered by Google. It is a good candidate for a managed object store, especially when you&amp;rsquo;re already running on GCP, and is production safe.&lt;/p&gt;
&lt;h3 id=&#34;file-system&#34;&gt;File System&lt;/h3&gt;
&lt;p&gt;The file system is the simplest backend for chunks, although it&amp;rsquo;s also susceptible to data loss as it&amp;rsquo;s unreplicated. This is common for single binary deployments though, as well as for those trying out loki or doing local development on the project. It is similar in concept to many Prometheus deployments where a single Prometheus is responsible for monitoring a fleet.&lt;/p&gt;
&lt;h3 id=&#34;s3&#34;&gt;S3&lt;/h3&gt;
&lt;p&gt;S3 is AWS&amp;rsquo;s hosted object store. It is a good candidate for a managed object store, especially when you&amp;rsquo;re already running on AWS, and is production safe.&lt;/p&gt;
&lt;h3 id=&#34;notable-mentions&#34;&gt;Notable Mentions&lt;/h3&gt;
&lt;p&gt;You may use any substitutable services, such as those that implement the S3 API like &lt;a href=&#34;https://min.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;MinIO&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;implementations---index&#34;&gt;Implementations - Index&lt;/h2&gt;
&lt;h3 id=&#34;single-store&#34;&gt;Single-Store&lt;/h3&gt;
&lt;p&gt;Also known as &amp;ldquo;boltdb-shipper&amp;rdquo; during development (and is still the schema &lt;code&gt;store&lt;/code&gt; name). The single store configurations for Loki utilize the chunk store for both chunks and the index, requiring just one store to run Loki.&lt;/p&gt;
&lt;p&gt;As of 2.0, this is the recommended index storage type, performance is comparable to a dedicated index type while providing a much less expensive and less complicated deployment.&lt;/p&gt;
&lt;h3 id=&#34;cassandra-1&#34;&gt;Cassandra&lt;/h3&gt;
&lt;p&gt;Cassandra can also be utilized for the index store and aside from the &lt;a href=&#34;../operations/storage/boltdb-shipper/&#34;&gt;boltdb-shipper&lt;/a&gt;, it&amp;rsquo;s the only non-cloud offering that can be used for the index that&amp;rsquo;s horizontally scalable and has configurable replication. It&amp;rsquo;s a good candidate when you already run Cassandra, are running on-prem, or do not wish to use a managed cloud offering.&lt;/p&gt;
&lt;h3 id=&#34;bigtable&#34;&gt;BigTable&lt;/h3&gt;
&lt;p&gt;Bigtable is a cloud database offered by Google. It is a good candidate for a managed index store if you&amp;rsquo;re already using it (due to it&amp;rsquo;s heavy fixed costs) or wish to run in GCP.&lt;/p&gt;
&lt;h3 id=&#34;dynamodb&#34;&gt;DynamoDB&lt;/h3&gt;
&lt;p&gt;DynamoDB is a cloud database offered by AWS. It is a good candidate for a managed index store, especially if you&amp;rsquo;re already running in AWS.&lt;/p&gt;
&lt;h4 id=&#34;rate-limiting&#34;&gt;Rate Limiting&lt;/h4&gt;
&lt;p&gt;DynamoDB is susceptible to rate limiting, particularly due to overconsuming what is called &lt;a href=&#34;https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;provisioned capacity&lt;/a&gt;. This can be controlled via the &lt;a href=&#34;#provisioning&#34;&gt;provisioning&lt;/a&gt; configs in the table manager.&lt;/p&gt;
&lt;h3 id=&#34;boltdb&#34;&gt;BoltDB&lt;/h3&gt;
&lt;p&gt;BoltDB is an embedded database on disk. It is not replicated and thus cannot be used for high availability or clustered Loki deployments, but is commonly paired with a &lt;code&gt;filesystem&lt;/code&gt; chunk store for proof of concept deployments, trying out Loki, and development. The &lt;a href=&#34;../operations/storage/boltdb-shipper/&#34;&gt;boltdb-shipper&lt;/a&gt; aims to support clustered deployments using &lt;code&gt;boltdb&lt;/code&gt; as an index.&lt;/p&gt;
&lt;h3 id=&#34;azure-storage-account&#34;&gt;Azure Storage Account&lt;/h3&gt;
&lt;p&gt;An Azure storage account contains all of your Azure Storage data objects: blobs, file shares, queues, tables, and disks.&lt;/p&gt;
&lt;h2 id=&#34;schema-configs&#34;&gt;Schema Configs&lt;/h2&gt;
&lt;p&gt;Loki aims to be backwards compatible and over the course of its development has had many internal changes that facilitate better and more efficient storage/querying. Loki allows incrementally upgrading to these new storage &lt;em&gt;schemas&lt;/em&gt; and can query across them transparently. This makes upgrading a breeze. For instance, this is what it looks like when migrating from the v10 -&amp;gt; v11 schemas starting 2020-07-01:&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;schema_config:
  configs:
    - from: 2019-07-01
      store: boltdb
      object_store: filesystem
      schema: v10
      index:
        prefix: index_
        period: 168h
    - from: 2020-07-01
      store: boltdb
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 168h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For all data ingested before 2020-07-01, Loki used the v10 schema and then switched after that point to the more effective v11. This dramatically simplifies upgrading, ensuring it&amp;rsquo;s simple to take advantages of new storage optimizations. These configs should be immutable for as long as you care about retention.&lt;/p&gt;
&lt;h2 id=&#34;table-manager&#34;&gt;Table Manager&lt;/h2&gt;
&lt;p&gt;One of the subcomponents in Loki is the &lt;code&gt;table-manager&lt;/code&gt;. It is responsible for pre-creating and expiring index tables. This helps partition the writes and reads in loki across a set of distinct indices in order to prevent unbounded growth.&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;table_manager:
  # The retention period must be a multiple of the index / chunks
  # table &amp;#34;period&amp;#34; (see period_config).
  retention_deletes_enabled: true
  # This is 15 weeks retention, based on the 168h (1week) period durations used in the rest of the examples.
  retention_period: 2520h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information, see the &lt;a href=&#34;../operations/storage/table-manager/&#34;&gt;table manager&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h3 id=&#34;provisioning&#34;&gt;Provisioning&lt;/h3&gt;
&lt;p&gt;In the case of AWS DynamoDB, you&amp;rsquo;ll likely want to tune the provisioned throughput for your tables as well. This is to prevent your tables being rate limited on one hand and assuming unnecessary cost on the other. By default Loki uses a &lt;a href=&#34;https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;provisioned capacity&lt;/a&gt; strategy for DynamoDB tables like so:&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;table_manager:
  index_tables_provisioning:
    # Read/write throughput requirements for the current table
    # (the table which would handle writes/reads for data timestamped at the current time)
    provisioned_write_throughput: &amp;lt;int&amp;gt; | default = 3000
    provisioned_read_throughput: &amp;lt;int&amp;gt; | default = 300

    # Read/write throughput requirements for non-current tables
    inactive_write_throughput: &amp;lt;int&amp;gt; | default = 1
    inactive_read_throughput: &amp;lt;int&amp;gt; | Default = 300&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note, there are a few other DynamoDB provisioning options including DynamoDB autoscaling and on-demand capacity. See the &lt;a href=&#34;../configuration/#provision_config&#34;&gt;provisioning configuration&lt;/a&gt; documentation for more information.&lt;/p&gt;
&lt;h2 id=&#34;upgrading-schemas&#34;&gt;Upgrading Schemas&lt;/h2&gt;
&lt;p&gt;When a new schema is released and you want to gain the advantages it provides, you can! Loki can transparently query &amp;amp; merge data from across schema boundaries so there is no disruption of service and upgrading is easy.&lt;/p&gt;
&lt;p&gt;First, you&amp;rsquo;ll want to create a new &lt;a href=&#34;../configuration#period_config&#34;&gt;period_config&lt;/a&gt; entry in your &lt;a href=&#34;../configuration#schema_config&#34;&gt;schema_config&lt;/a&gt;. The important thing to remember here is to set this at some point in the &lt;em&gt;future&lt;/em&gt; and then roll out the config file changes to Loki. This allows the table manager to create the required table in advance of writes and ensures that existing data isn&amp;rsquo;t queried as if it adheres to the new schema.&lt;/p&gt;
&lt;p&gt;As an example, let&amp;rsquo;s say it&amp;rsquo;s 2020-07-14 and we want to start using the &lt;code&gt;v11&lt;/code&gt; schema on the 20th:&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;schema_config:
  configs:
    - from: 2019-07-14
      store: boltdb
      object_store: filesystem
      schema: v10
      index:
        prefix: index_
        period: 168h
    - from: 2020-07-20
      store: boltdb
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 168h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;It&amp;rsquo;s that easy; we just created a new entry starting on the 20th.&lt;/p&gt;
&lt;h2 id=&#34;retention&#34;&gt;Retention&lt;/h2&gt;
&lt;p&gt;With the exception of the &lt;code&gt;filesystem&lt;/code&gt; chunk store, Loki will not delete old chunk stores. This is generally handled instead by configuring TTLs (time to live) in the chunk store of your choice (bucket lifecycles in S3/GCS, and TTLs in Cassandra). Neither will Loki currently delete old data when your local disk fills when using the &lt;code&gt;filesystem&lt;/code&gt; chunk store &amp;ndash; deletion is only determined by retention duration.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;re interested in adding targeted deletion in future Loki releases (think tenant or stream level granularity) and may include other strategies as well.&lt;/p&gt;
&lt;p&gt;For more information, see the &lt;a href=&#34;../operations/storage/retention/&#34;&gt;retention configuration&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;h3 id=&#34;single-machinelocal-development-boltdbfilesystem&#34;&gt;Single machine/local development (boltdb&#43;filesystem)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/grafana/loki/blob/master/cmd/loki/loki-local-config.yaml&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;The repo contains a working example&lt;/a&gt;, you may want to checkout a tag of the repo to make sure you get a compatible example.&lt;/p&gt;
&lt;h3 id=&#34;gcp-deployment-gcs-single-store&#34;&gt;GCP deployment (GCS Single Store)&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;storage_config:
  boltdb_shipper:
    active_index_directory: /loki/boltdb-shipper-active
    cache_location: /loki/boltdb-shipper-cache
    cache_ttl: 24h         # Can be increased for faster performance over longer query periods, uses more disk space
    shared_store: gcs
  gcs:
      bucket_name: &amp;lt;bucket&amp;gt;

schema_config:
  configs:
    - from: 2020-07-01
      store: boltdb-shipper
      object_store: gcs
      schema: v11
      index:
        prefix: index_
        period: 24h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;aws-deployment-s3-single-store&#34;&gt;AWS deployment (S3 Single Store)&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;storage_config:
  boltdb_shipper:
    active_index_directory: /loki/boltdb-shipper-active
    cache_location: /loki/boltdb-shipper-cache
    cache_ttl: 24h         # Can be increased for faster performance over longer query periods, uses more disk space
    shared_store: s3
  aws:
    s3: s3://&amp;lt;access_key&amp;gt;:&amp;lt;uri-encoded-secret-access-key&amp;gt;@&amp;lt;region&amp;gt;
    bucketnames: &amp;lt;bucket1,bucket2&amp;gt;

schema_config:
  configs:
    - from: 2020-07-01
      store: boltdb-shipper
      object_store: aws
      schema: v11
      index:
        prefix: index_
        period: 24h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you don&amp;rsquo;t wish to hard-code S3 credentials, you can also configure an EC2
instance role by changing the &lt;code&gt;storage_config&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;storage_config:
  aws:
    s3: s3://region
    bucketnames: &amp;lt;bucket1,bucket2&amp;gt;
    dynamodb:
      dynamodb_url: dynamodb://region&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;on-prem-deployment-cassandracassandra&#34;&gt;On prem deployment (Cassandra&#43;Cassandra)&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Keeping this for posterity, but this is likely not a common config. Cassandra should work and could be faster in some situations but is likely much more expensive.&lt;/strong&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;storage_config:
  cassandra:
    addresses: &amp;lt;comma-separated-IPs-or-hostnames&amp;gt;
    keyspace: &amp;lt;keyspace&amp;gt;
    auth: &amp;lt;true|false&amp;gt;
    username: &amp;lt;username&amp;gt; # only applicable when auth=true
    password: &amp;lt;password&amp;gt; # only applicable when auth=true

schema_config:
  configs:
    - from: 2020-07-01
      store: cassandra
      object_store: cassandra
      schema: v11
      index:
        prefix: index_
        period: 168h
      chunks:
        prefix: chunk_
        period: 168h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;on-prem-deployment-minio-single-store&#34;&gt;On prem deployment (MinIO Single Store)&lt;/h3&gt;
&lt;p&gt;We configure MinIO by using the AWS config because MinIO implements the S3 API:&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;storage_config:
  aws:
    # Note: use a fully qualified domain name, like localhost.
    # full example: http://loki:supersecret@localhost.:9000
    s3: http&amp;lt;s&amp;gt;://&amp;lt;username&amp;gt;:&amp;lt;secret&amp;gt;@&amp;lt;fqdn&amp;gt;:&amp;lt;port&amp;gt;
    s3forcepathstyle: true
  boltdb_shipper:
    active_index_directory: /loki/boltdb-shipper-active
    cache_location: /loki/boltdb-shipper-cache
    cache_ttl: 24h         # Can be increased for faster performance over longer query periods, uses more disk space
    shared_store: s3

schema_config:
  configs:
    - from: 2020-07-01
      store: boltdb-shipper
      object_store: aws
      schema: v11
      index:
        prefix: index_
        period: 24h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;azure-storage-account-1&#34;&gt;Azure Storage Account&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;schema_config:
  configs:
  - from: &amp;#34;2020-12-11&amp;#34;
    index:
      period: 24h
      prefix: index_
    object_store: azure
    schema: v11
    store: boltdb-shipper
storage_config:
  azure:
    # Your Azure storage account name
    account_name: &amp;lt;account-name&amp;gt;
    # For the account-key, see docs: https://docs.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage?tabs=azure-portal
    account_key: &amp;lt;account-key&amp;gt;
    # See https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction#containers
    container_name: &amp;lt;container-name&amp;gt;
    use_managed_identity: &amp;lt;true|false&amp;gt;
    # Providing a user assigned ID will override use_managed_identity
    user_assigned_id: &amp;lt;user-assigned-identity-id&amp;gt;
    request_timeout: 0    
  boltdb_shipper:
    active_index_directory: /data/loki/boltdb-shipper-active
    cache_location: /data/loki/boltdb-shipper-cache
    cache_ttl: 24h
    shared_store: azure
  filesystem:
    directory: /data/loki/chunks&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="storage">Storage&lt;/h1>
&lt;p>Unlike other logging systems, Grafana Loki is built around the idea of only indexing
metadata about your logs: labels (just like Prometheus labels). Log data itself
is then compressed and stored in chunks in object stores such as S3 or GCS, or
even locally on the filesystem. A small index and highly compressed chunks
simplifies the operation and significantly lowers the cost of Loki.&lt;/p></description></item></channel></rss>