<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>LogCLI on Grafana Labs</title><link>https://grafana.com/docs/loki/v3.7.x/query/logcli/</link><description>Recent content in LogCLI on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/loki/v3.7.x/query/logcli/index.xml" rel="self" type="application/rss+xml"/><item><title>LogCLI getting started</title><link>https://grafana.com/docs/loki/v3.7.x/query/logcli/getting-started/</link><pubDate>Thu, 09 Apr 2026 02:28:18 +0000</pubDate><guid>https://grafana.com/docs/loki/v3.7.x/query/logcli/getting-started/</guid><content><![CDATA[&lt;h1 id=&#34;logcli-getting-started&#34;&gt;LogCLI getting started&lt;/h1&gt;
&lt;p&gt;logcli is a command-line client for Loki that lets you run 
    &lt;a href=&#34;/docs/loki/v3.7.x/query/&#34;&gt;LogQL&lt;/a&gt; queries against your Loki instance. The &lt;code&gt;query&lt;/code&gt; 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.&lt;/p&gt;
&lt;p&gt;This is useful, for example, if you want to download a range of logs from Loki. Or want to perform analytical administration tasks, for example, discover the number of log streams to understand your label cardinality, or find out the estimated volume of data that a query will search over. You can also use logcli as part of shell scripts.&lt;/p&gt;
&lt;p&gt;If you are a Grafana Cloud user, you can also use logcli to query logs that you have exported to long-term storage with &lt;a href=&#34;/docs/grafana-cloud/send-data/logs/export/&#34;&gt;Cloud Logs Export&lt;/a&gt;, or any other Loki formatted log data.&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;Note that logcli is a querying tool, it cannot be used to ingest logs.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;install-logcli&#34;&gt;Install logcli&lt;/h2&gt;
&lt;p&gt;As a best practice, you should download the version of logcli that matches your Loki version. And upgrade your logcli when you upgrade your version of Loki.&lt;/p&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;p&gt;Builds are available for Linux, Mac, and Windows.&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;set-up-command-completion&#34;&gt;Set up command completion&lt;/h2&gt;
&lt;p&gt;You can set up tab-completion for &lt;code&gt;logcli&lt;/code&gt; with one of the two options, depending on your shell:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For bash, add this to your &lt;code&gt;~/.bashrc&lt;/code&gt; file:&lt;/li&gt;
&lt;/ul&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;eval &amp;#34;$(logcli --completion-script-bash)&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;For zsh, add this to your &lt;code&gt;~/.zshrc&lt;/code&gt; file:&lt;/li&gt;
&lt;/ul&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;eval &amp;#34;$(logcli --completion-script-zsh)&amp;#34;&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;p&gt;Once you have installed logcli, you can run it in the following way:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;logcli &amp;lt;command&amp;gt; [&amp;lt;flags&amp;gt;, &amp;lt;args&amp;gt; ...]&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;command&amp;gt;&lt;/code&gt; points to one of the commands, detailed in the 
    &lt;a href=&#34;/docs/loki/v3.7.x/query/logcli/getting-started/#logcli-command-reference&#34;&gt;command reference&lt;/a&gt; below.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;flags&amp;gt;&lt;/code&gt; is one of the subcommands available for each command.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;args&amp;gt;&lt;/code&gt; is a list of space separated arguments. Arguments can optionally be overridden using environment variables. Environment variables will always take precedence over command line arguments.&lt;/p&gt;
&lt;h3 id=&#34;authenticate-to-loki&#34;&gt;Authenticate to Loki&lt;/h3&gt;
&lt;p&gt;To connect to a Loki instance, set the following argument:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--addr=http://loki.example.com:3100&lt;/code&gt; or the &lt;code&gt;LOKI_ADDR&lt;/code&gt; environment variable&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example, to query a local Loki 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

logcli query &amp;#39;{service_name=&amp;#34;website&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To connect to a Loki instance which requires authentication, you will need to additionally set the following arguments:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--username&lt;/code&gt; or the &lt;code&gt;LOKI_USERNAME&lt;/code&gt; environment variable&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--password&lt;/code&gt; or the &lt;code&gt;LOKI_PASSWORD&lt;/code&gt; environment variable&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example, to query Grafana Cloud:&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;

logcli query &amp;#39;{service_name=&amp;#34;website&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To specify a particular tenant, set the following argument:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--org-id&lt;/code&gt; or the &lt;code&gt;LOKI_ORG_ID&lt;/code&gt; environment variable&lt;/li&gt;
&lt;/ul&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;If you are running Loki behind a proxy server and you have

    &lt;a href=&#34;/docs/loki/v3.7.x/operations/authentication/&#34;&gt;authentication&lt;/a&gt; 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&gt;

&lt;h2 id=&#34;logcli-command-reference&#34;&gt;LogCLI command reference&lt;/h2&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;shell&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-shell&#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:
      --[no-]help             Show context-sensitive help (also try --help-long
                              and --help-man).
      --[no-]version          Show application version.
  -q, --[no-]quiet            Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                              Specify the format of timestamps in the default
                              output mode [rfc3339, rfc3339nano, rfc822z,
                              rfc1123z, stampmicro, stampmilli, stampnano,
                              unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;           Username for HTTP basic auth. Can also be set
                              using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;           Password for HTTP basic auth. Can also be set
                              using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;            Path to the server Certificate Authority.
                              Can also be set using LOKI_CA_CERT_PATH env var.
                              ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify  Server certificate TLS skip verify. Can also
                              be set using LOKI_TLS_SKIP_VERIFY env var.
                              ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;               Path to the client certificate. Can also
                              be set using LOKI_CLIENT_CERT_PATH env var.
                              ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                Path to the client certificate key. Can also
                              be set using LOKI_CLIENT_KEY_PATH env var.
                              ($LOKI_CLIENT_KEY_PATH)
      --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.
                              Can also be set using LOKI_ORG_ID env var.
                              ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;         adds X-Query-Tags http header to API requests.
                              This header value will be part of `metrics.go`
                              statistics. Useful for tracking the query.
                              Can also be set using LOKI_QUERY_TAGS env var.
                              ($LOKI_QUERY_TAGS)
      --[no-]nocache          adds Cache-Control: no-cache http header to API
                              requests. Can also be set using LOKI_NO_CACHE env
                              var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;       adds the Authorization header to API requests for
                              authentication purposes. Can also be set using
                              LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;  adds the Authorization header to API requests
                              for authentication purposes. Can also be
                              set using LOKI_BEARER_TOKEN_FILE env var.
                              ($LOKI_BEARER_TOKEN_FILE)
      --retries=0             How many times to retry each query when
                              getting an error response from Loki. Can also
                              be set using LOKI_CLIENT_RETRIES env var.
                              ($LOKI_CLIENT_RETRIES)
      --min-backoff=0         Minimum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MIN_BACKOFF env var.
                              ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0         Maximum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MAX_BACKOFF env var.
                              ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                              The authorization header used. Can also
                              be set using LOKI_AUTH_HEADER env var.
                              ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;          The http or https proxy to use when
                              making requests. Can also be set
                              using LOKI_HTTP_PROXY_URL env var.
                              ($LOKI_HTTP_PROXY_URL)
      --[no-]compress         Request that Loki compress returned
                              data in transit. Can also be set
                              using LOKI_HTTP_COMPRESSION env var.
                              ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy         Use ProxyFromEnvironment to use net/http
                              ProxyFromEnvironment configuration, eg HTTP_PROXY
                              ($LOKI_ENV_PROXY)
      --log.level             Only log messages with the given severity or above. Valid levels: [debug, info, warn, error]

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. In default output mode the
    --output-timestamp-format flag can be used to modify the output timestamp.

    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;

    Example with --output-timestamp-format:

      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-timestamp-format=rfc3339nano
         &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.

    Parallelization:

    You can download an unlimited number of logs in parallel, there are a few
    flags which control this behaviour:

      --parallel-duration
      --parallel-max-workers
      --part-path-prefix
      --overwrite-completed-parts
      --merge-parts
      --keep-parts

    Refer to the help for each flag for details about what each of them do.

    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
         --parallel-duration=&amp;#34;15m&amp;#34;
         --parallel-max-workers=&amp;#34;4&amp;#34;
         --part-path-prefix=&amp;#34;/tmp/my_query&amp;#34;
         --merge-parts
         &amp;#39;my-query&amp;#39;

    This example will create a queue of jobs to execute, each being 15 minutes
    in duration. In this case, that means, for the 10-hour total duration,
    there will be forty 15-minute jobs. The --limit flag is ignored.

    It will start four workers, and they will each take a job to work on from
    the queue until all the jobs have been completed.

    Each job will save a &amp;#34;part&amp;#34; file to the location specified by the
    --part-path-prefix. Different prefixes can be used to run multiple queries
    at the same time. The timestamp of the start and end of the part is in
    the file name. While the part is being downloaded, the filename will
    end in &amp;#34;.part&amp;#34;, when it is complete, the file will be renamed to remove
    this &amp;#34;.part&amp;#34; extension. By default, if a completed part file is found,
    that part will not be downloaded again. This can be overridden with the
    --overwrite-completed-parts flag.

    Part file example using the previous command, adding --keep-parts so they
    are not deleted:

    Since we don&amp;#39;t have the --forward flag, the parts will be downloaded in
    reverse. Two of the workers have finished their jobs (last two files),
    and have picked up the next jobs in the queue. Running ls, this is what we
    should expect to see.

    $ ls -1 /tmp/my_query*
    /tmp/my_query_20210119T183000_20210119T184500.part.tmp
    /tmp/my_query_20210119T184500_20210119T190000.part.tmp
    /tmp/my_query_20210119T190000_20210119T191500.part.tmp
    /tmp/my_query_20210119T191500_20210119T193000.part.tmp
    /tmp/my_query_20210119T193000_20210119T194500.part
    /tmp/my_query_20210119T194500_20210119T200000.part

    If you do not specify the --merge-parts flag, the part files will be
    downloaded, and logcli will exit, and you can process the files as you wish.
    With the flag specified, the part files will be read in order, and the
    output printed to the terminal. The lines will be printed as soon as the
    next part is complete, you don&amp;#39;t have to wait for all the parts to download
    before getting output. The --merge-parts flag will remove the part files
    when it is done reading each of them. To change this, you can use the
    --keep-parts flag, and the part files will not be removed.

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.

fmt
    Formats a LogQL query.

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

    The &amp;#34;stats&amp;#34; command will take the provided query and return statistics
    from the index on how much data is contained in the matching stream(s).
    This only works against Loki instances using the TSDB index format.

    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 stats
         --timezone=UTC
         --from=&amp;#34;2021-01-19T10:00:00Z&amp;#34;
         --to=&amp;#34;2021-01-19T20:00:00Z&amp;#34;
         &amp;#39;my-query&amp;#39;

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

    The &amp;#34;volume&amp;#34; command will take the provided label selector(s) and return
    aggregate volumes for series matching those volumes. This only works against
    Loki instances using the TSDB index format.

    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 volume
         --timezone=UTC
         --from=&amp;#34;2021-01-19T10:00:00Z&amp;#34;
         --to=&amp;#34;2021-01-19T20:00:00Z&amp;#34;
         &amp;#39;my-query&amp;#39;

volume_range [&amp;lt;flags&amp;gt;] &amp;lt;query&amp;gt;
    Run a volume query and return timeseries data.

    The &amp;#34;volume_range&amp;#34; command will take the provided label selector(s) and
    return aggregate volumes for series matching those volumes, aggregated into
    buckets according to the step value. This only works against Loki instances
    using the TSDB index format.

    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 volume_range
      	   --timezone=UTC
      	   --from=&amp;#34;2021-01-19T10:00:00Z&amp;#34;
      	   --to=&amp;#34;2021-01-19T20:00:00Z&amp;#34;
           --step=1h
      	   &amp;#39;my-query&amp;#39;

detected-fields [&amp;lt;flags&amp;gt;] &amp;lt;query&amp;gt; [&amp;lt;field&amp;gt;]
    Run a query for detected fields..

delete &amp;lt;command&amp;gt; [&amp;lt;args&amp;gt; ...]
    Manage log deletion requests.

    The &amp;#34;detected-fields&amp;#34; command will return information about fields detected
    using either the &amp;#34;logfmt&amp;#34; or &amp;#34;json&amp;#34; parser against the log lines returned by
    the provided query for the provided time range.

    The &amp;#34;detected-fields&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 detected-fields
         --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 100 fields by default; use --field-limit to
    increase. The query is limited to processing 1000 lines per subquery;
    use --line-limit to increase.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;query-command-reference&#34;&gt;&lt;code&gt;query&lt;/code&gt; 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 &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&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-shell&#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. In default output mode the
--output-timestamp-format flag can be used to modify the output timestamp.

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;

Example with --output-timestamp-format:

  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-timestamp-format=rfc3339nano
     &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.

Parallelization:

You can download an unlimited number of logs in parallel, there are a few flags
which control this behaviour:

  --parallel-duration
  --parallel-max-workers
  --part-path-prefix
  --overwrite-completed-parts
  --merge-parts
  --keep-parts

Refer to the help for each flag for details about what each of them do.

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
     --parallel-duration=&amp;#34;15m&amp;#34;
     --parallel-max-workers=&amp;#34;4&amp;#34;
     --part-path-prefix=&amp;#34;/tmp/my_query&amp;#34;
     --merge-parts
     &amp;#39;my-query&amp;#39;

This example will create a queue of jobs to execute, each being 15 minutes in
duration. In this case, that means, for the 10-hour total duration, there will
be forty 15-minute jobs. The --limit flag is ignored.

It will start four workers, and they will each take a job to work on from the
queue until all the jobs have been completed.

Each job will save a &amp;#34;part&amp;#34; file to the location specified by the
--part-path-prefix. Different prefixes can be used to run multiple queries at
the same time. The timestamp of the start and end of the part is in the file
name. While the part is being downloaded, the filename will end in &amp;#34;.part&amp;#34;,
when it is complete, the file will be renamed to remove this &amp;#34;.part&amp;#34; extension.
By default, if a completed part file is found, that part will not be downloaded
again. This can be overridden with the --overwrite-completed-parts flag.

Part file example using the previous command, adding --keep-parts so they are
not deleted:

Since we don&amp;#39;t have the --forward flag, the parts will be downloaded in reverse.
Two of the workers have finished their jobs (last two files), and have picked up
the next jobs in the queue. Running ls, this is what we should expect to see.

$ ls -1 /tmp/my_query* /tmp/my_query_20210119T183000_20210119T184500.part.tmp
/tmp/my_query_20210119T184500_20210119T190000.part.tmp
/tmp/my_query_20210119T190000_20210119T191500.part.tmp
/tmp/my_query_20210119T191500_20210119T193000.part.tmp
/tmp/my_query_20210119T193000_20210119T194500.part
/tmp/my_query_20210119T194500_20210119T200000.part

If you do not specify the --merge-parts flag, the part files will be downloaded,
and logcli will exit, and you can process the files as you wish. With the flag
specified, the part files will be read in order, and the output printed to
the terminal. The lines will be printed as soon as the next part is complete,
you don&amp;#39;t have to wait for all the parts to download before getting output.
The --merge-parts flag will remove the part files when it is done reading each
of them. To change this, you can use the --keep-parts flag, and the part files
will not be removed.


Flags:
      --[no-]help               Show context-sensitive help (also try
                                --help-long and --help-man).
      --[no-]version            Show application version.
  -q, --[no-]quiet              Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                                Specify the format of timestamps in the default
                                output mode [rfc3339, rfc3339nano, rfc822z,
                                rfc1123z, stampmicro, stampmilli, stampnano,
                                unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;             Username for HTTP basic auth. Can also be set
                                using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;             Password for HTTP basic auth. Can also be set
                                using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;              Path to the server Certificate Authority.
                                Can also be set using LOKI_CA_CERT_PATH env var.
                                ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify    Server certificate TLS skip verify. Can also
                                be set using LOKI_TLS_SKIP_VERIFY env var.
                                ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;                 Path to the client certificate. Can also
                                be set using LOKI_CLIENT_CERT_PATH env var.
                                ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                  Path to the client certificate key. Can also
                                be set using LOKI_CLIENT_KEY_PATH env var.
                                ($LOKI_CLIENT_KEY_PATH)
      --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.
                                Can also be set using LOKI_ORG_ID env var.
                                ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;           adds X-Query-Tags http header to API requests.
                                This header value will be part of `metrics.go`
                                statistics. Useful for tracking the query.
                                Can also be set using LOKI_QUERY_TAGS env var.
                                ($LOKI_QUERY_TAGS)
      --[no-]nocache            adds Cache-Control: no-cache http header to API
                                requests. Can also be set using LOKI_NO_CACHE
                                env var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;         adds the Authorization header to API
                                requests for authentication purposes.
                                Can also be set using LOKI_BEARER_TOKEN env var.
                                ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;    adds the Authorization header to API requests
                                for authentication purposes. Can also be
                                set using LOKI_BEARER_TOKEN_FILE env var.
                                ($LOKI_BEARER_TOKEN_FILE)
      --retries=0               How many times to retry each query when
                                getting an error response from Loki. Can also
                                be set using LOKI_CLIENT_RETRIES env var.
                                ($LOKI_CLIENT_RETRIES)
      --min-backoff=0           Minimum backoff time between retries. Can also
                                be set using LOKI_CLIENT_MIN_BACKOFF env var.
                                ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0           Maximum backoff time between retries. Can also
                                be set using LOKI_CLIENT_MAX_BACKOFF env var.
                                ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                                The authorization header used. Can also
                                be set using LOKI_AUTH_HEADER env var.
                                ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;            The http or https proxy to use when
                                making requests. Can also be set
                                using LOKI_HTTP_PROXY_URL env var.
                                ($LOKI_HTTP_PROXY_URL)
      --[no-]compress           Request that Loki compress returned
                                data in transit. Can also be set
                                using LOKI_HTTP_COMPRESSION env var.
                                ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy           Use ProxyFromEnvironment to use net/http
                                ProxyFromEnvironment configuration, eg
                                HTTP_PROXY ($LOKI_ENV_PROXY)
      --limit=30                Limit on number of entries to print. Setting it
                                to 0 will fetch all entries.
      --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
      --parallel-duration=1h    Split the range into jobs of this length to
                                download the logs in parallel. This will
                                result in the logs being out of order.
                                Use --part-path-prefix to create a file per job
                                to maintain ordering.
      --parallel-max-workers=1  Max number of workers to start up for parallel
                                jobs. A value of 1 will not create any parallel
                                workers. When using parallel workers, limit is
                                ignored.
      --part-path-prefix=PART-PATH-PREFIX  
                                When set, each server response will be saved
                                to a file with this prefix. Creates files in
                                the format: &amp;#39;prefix-utc_start-utc_end.part&amp;#39;.
                                Intended to be used with the parallel-* flags
                                so that you can combine the files to maintain
                                ordering based on the filename. Default is to
                                write to stdout.
      --[no-]overwrite-completed-parts  
                                Overwrites completed part files. This will
                                download the range again, and replace the
                                original completed part file. Default will skip
                                a range if it&amp;#39;s part file is already downloaded.
      --[no-]merge-parts        Reads the part files in order and writes the
                                output to stdout. Original part files will be
                                deleted with this option.
      --[no-]keep-parts         Overrides the default behaviour of --merge-parts
                                which will delete the part files once all the
                                files have been read. This option will keep the
                                part files.
      --[no-]forward            Scan forwards through logs.
      --[no-]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.
      --[no-]include-common-labels  
                                Include common labels in output for each log
                                line.
      --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.
      --[no-]remote-schema      Execute the current query using a remote schema
                                retrieved from the configured -schema-store.
      --schema-store=&amp;#34;&amp;#34;         Store used for retrieving remote schema.
      --[no-]colored-output     Show output with colored labels
  -t, --[no-]tail               Tail the logs
  -f, --[no-]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;instant-query-command-reference&#34;&gt;&lt;code&gt;instant-query&lt;/code&gt; command reference&lt;/h3&gt;
&lt;p&gt;The output of &lt;code&gt;logcli help instant-query&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;shell&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-shell&#34;&gt;usage: logcli 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/


Flags:
      --[no-]help             Show context-sensitive help (also try --help-long
                              and --help-man).
      --[no-]version          Show application version.
  -q, --[no-]quiet            Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                              Specify the format of timestamps in the default
                              output mode [rfc3339, rfc3339nano, rfc822z,
                              rfc1123z, stampmicro, stampmilli, stampnano,
                              unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;           Username for HTTP basic auth. Can also be set
                              using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;           Password for HTTP basic auth. Can also be set
                              using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;            Path to the server Certificate Authority.
                              Can also be set using LOKI_CA_CERT_PATH env var.
                              ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify  Server certificate TLS skip verify. Can also
                              be set using LOKI_TLS_SKIP_VERIFY env var.
                              ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;               Path to the client certificate. Can also
                              be set using LOKI_CLIENT_CERT_PATH env var.
                              ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                Path to the client certificate key. Can also
                              be set using LOKI_CLIENT_KEY_PATH env var.
                              ($LOKI_CLIENT_KEY_PATH)
      --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.
                              Can also be set using LOKI_ORG_ID env var.
                              ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;         adds X-Query-Tags http header to API requests.
                              This header value will be part of `metrics.go`
                              statistics. Useful for tracking the query.
                              Can also be set using LOKI_QUERY_TAGS env var.
                              ($LOKI_QUERY_TAGS)
      --[no-]nocache          adds Cache-Control: no-cache http header to API
                              requests. Can also be set using LOKI_NO_CACHE env
                              var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;       adds the Authorization header to API requests for
                              authentication purposes. Can also be set using
                              LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;  adds the Authorization header to API requests
                              for authentication purposes. Can also be
                              set using LOKI_BEARER_TOKEN_FILE env var.
                              ($LOKI_BEARER_TOKEN_FILE)
      --retries=0             How many times to retry each query when
                              getting an error response from Loki. Can also
                              be set using LOKI_CLIENT_RETRIES env var.
                              ($LOKI_CLIENT_RETRIES)
      --min-backoff=0         Minimum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MIN_BACKOFF env var.
                              ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0         Maximum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MAX_BACKOFF env var.
                              ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                              The authorization header used. Can also
                              be set using LOKI_AUTH_HEADER env var.
                              ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;          The http or https proxy to use when
                              making requests. Can also be set
                              using LOKI_HTTP_PROXY_URL env var.
                              ($LOKI_HTTP_PROXY_URL)
      --[no-]compress         Request that Loki compress returned
                              data in transit. Can also be set
                              using LOKI_HTTP_COMPRESSION env var.
                              ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy         Use ProxyFromEnvironment to use net/http
                              ProxyFromEnvironment configuration, eg HTTP_PROXY
                              ($LOKI_ENV_PROXY)
      --limit=30              Limit on number of entries to print. Setting it to
                              0 will fetch all entries.
      --now=NOW               Time at which to execute the instant query.
      --[no-]forward          Scan forwards through logs.
      --[no-]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.
      --[no-]include-common-labels  
                              Include common labels in output for each log line.
      --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.
      --[no-]remote-schema    Execute the current query using a remote schema
                              retrieved from the configured -schema-store.
      --schema-store=&amp;#34;&amp;#34;       Store used for retrieving remote schema.
      --[no-]colored-output   Show output with colored labels

Args:
  &amp;lt;query&amp;gt;  eg &amp;#39;rate({foo=&amp;#34;bar&amp;#34;} |~ &amp;#34;.*error.*&amp;#34; [5m])&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;labels-command-reference&#34;&gt;&lt;code&gt;labels&lt;/code&gt; 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 &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&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-shell&#34;&gt;usage: logcli labels [&amp;lt;flags&amp;gt;] [&amp;lt;label&amp;gt;]

Find values for a given label.


Flags:
      --[no-]help             Show context-sensitive help (also try --help-long
                              and --help-man).
      --[no-]version          Show application version.
  -q, --[no-]quiet            Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                              Specify the format of timestamps in the default
                              output mode [rfc3339, rfc3339nano, rfc822z,
                              rfc1123z, stampmicro, stampmilli, stampnano,
                              unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;           Username for HTTP basic auth. Can also be set
                              using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;           Password for HTTP basic auth. Can also be set
                              using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;            Path to the server Certificate Authority.
                              Can also be set using LOKI_CA_CERT_PATH env var.
                              ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify  Server certificate TLS skip verify. Can also
                              be set using LOKI_TLS_SKIP_VERIFY env var.
                              ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;               Path to the client certificate. Can also
                              be set using LOKI_CLIENT_CERT_PATH env var.
                              ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                Path to the client certificate key. Can also
                              be set using LOKI_CLIENT_KEY_PATH env var.
                              ($LOKI_CLIENT_KEY_PATH)
      --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.
                              Can also be set using LOKI_ORG_ID env var.
                              ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;         adds X-Query-Tags http header to API requests.
                              This header value will be part of `metrics.go`
                              statistics. Useful for tracking the query.
                              Can also be set using LOKI_QUERY_TAGS env var.
                              ($LOKI_QUERY_TAGS)
      --[no-]nocache          adds Cache-Control: no-cache http header to API
                              requests. Can also be set using LOKI_NO_CACHE env
                              var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;       adds the Authorization header to API requests for
                              authentication purposes. Can also be set using
                              LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;  adds the Authorization header to API requests
                              for authentication purposes. Can also be
                              set using LOKI_BEARER_TOKEN_FILE env var.
                              ($LOKI_BEARER_TOKEN_FILE)
      --retries=0             How many times to retry each query when
                              getting an error response from Loki. Can also
                              be set using LOKI_CLIENT_RETRIES env var.
                              ($LOKI_CLIENT_RETRIES)
      --min-backoff=0         Minimum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MIN_BACKOFF env var.
                              ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0         Maximum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MAX_BACKOFF env var.
                              ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                              The authorization header used. Can also
                              be set using LOKI_AUTH_HEADER env var.
                              ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;          The http or https proxy to use when
                              making requests. Can also be set
                              using LOKI_HTTP_PROXY_URL env var.
                              ($LOKI_HTTP_PROXY_URL)
      --[no-]compress         Request that Loki compress returned
                              data in transit. Can also be set
                              using LOKI_HTTP_COMPRESSION env var.
                              ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy         Use ProxyFromEnvironment to use net/http
                              ProxyFromEnvironment configuration, eg HTTP_PROXY
                              ($LOKI_ENV_PROXY)
      --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;series-command-reference&#34;&gt;&lt;code&gt;series&lt;/code&gt; 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 &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&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-shell&#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:
      --[no-]help             Show context-sensitive help (also try --help-long
                              and --help-man).
      --[no-]version          Show application version.
  -q, --[no-]quiet            Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                              Specify the format of timestamps in the default
                              output mode [rfc3339, rfc3339nano, rfc822z,
                              rfc1123z, stampmicro, stampmilli, stampnano,
                              unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;           Username for HTTP basic auth. Can also be set
                              using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;           Password for HTTP basic auth. Can also be set
                              using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;            Path to the server Certificate Authority.
                              Can also be set using LOKI_CA_CERT_PATH env var.
                              ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify  Server certificate TLS skip verify. Can also
                              be set using LOKI_TLS_SKIP_VERIFY env var.
                              ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;               Path to the client certificate. Can also
                              be set using LOKI_CLIENT_CERT_PATH env var.
                              ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                Path to the client certificate key. Can also
                              be set using LOKI_CLIENT_KEY_PATH env var.
                              ($LOKI_CLIENT_KEY_PATH)
      --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.
                              Can also be set using LOKI_ORG_ID env var.
                              ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;         adds X-Query-Tags http header to API requests.
                              This header value will be part of `metrics.go`
                              statistics. Useful for tracking the query.
                              Can also be set using LOKI_QUERY_TAGS env var.
                              ($LOKI_QUERY_TAGS)
      --[no-]nocache          adds Cache-Control: no-cache http header to API
                              requests. Can also be set using LOKI_NO_CACHE env
                              var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;       adds the Authorization header to API requests for
                              authentication purposes. Can also be set using
                              LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;  adds the Authorization header to API requests
                              for authentication purposes. Can also be
                              set using LOKI_BEARER_TOKEN_FILE env var.
                              ($LOKI_BEARER_TOKEN_FILE)
      --retries=0             How many times to retry each query when
                              getting an error response from Loki. Can also
                              be set using LOKI_CLIENT_RETRIES env var.
                              ($LOKI_CLIENT_RETRIES)
      --min-backoff=0         Minimum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MIN_BACKOFF env var.
                              ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0         Maximum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MAX_BACKOFF env var.
                              ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                              The authorization header used. Can also
                              be set using LOKI_AUTH_HEADER env var.
                              ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;          The http or https proxy to use when
                              making requests. Can also be set
                              using LOKI_HTTP_PROXY_URL env var.
                              ($LOKI_HTTP_PROXY_URL)
      --[no-]compress         Request that Loki compress returned
                              data in transit. Can also be set
                              using LOKI_HTTP_COMPRESSION env var.
                              ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy         Use ProxyFromEnvironment to use net/http
                              ProxyFromEnvironment configuration, eg HTTP_PROXY
                              ($LOKI_ENV_PROXY)
      --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)
      --[no-]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;stats-command-reference&#34;&gt;&lt;code&gt;stats&lt;/code&gt; command reference&lt;/h3&gt;
&lt;p&gt;The output of &lt;code&gt;logcli help stats&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;shell&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-shell&#34;&gt;usage: logcli stats [&amp;lt;flags&amp;gt;] &amp;lt;query&amp;gt;

Run a stats query.

The &amp;#34;stats&amp;#34; command will take the provided query and return statistics from the
index on how much data is contained in the matching stream(s). This only works
against Loki instances using the TSDB index format.

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 stats
     --timezone=UTC
     --from=&amp;#34;2021-01-19T10:00:00Z&amp;#34;
     --to=&amp;#34;2021-01-19T20:00:00Z&amp;#34;
     &amp;#39;my-query&amp;#39;


Flags:
      --[no-]help             Show context-sensitive help (also try --help-long
                              and --help-man).
      --[no-]version          Show application version.
  -q, --[no-]quiet            Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                              Specify the format of timestamps in the default
                              output mode [rfc3339, rfc3339nano, rfc822z,
                              rfc1123z, stampmicro, stampmilli, stampnano,
                              unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;           Username for HTTP basic auth. Can also be set
                              using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;           Password for HTTP basic auth. Can also be set
                              using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;            Path to the server Certificate Authority.
                              Can also be set using LOKI_CA_CERT_PATH env var.
                              ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify  Server certificate TLS skip verify. Can also
                              be set using LOKI_TLS_SKIP_VERIFY env var.
                              ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;               Path to the client certificate. Can also
                              be set using LOKI_CLIENT_CERT_PATH env var.
                              ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                Path to the client certificate key. Can also
                              be set using LOKI_CLIENT_KEY_PATH env var.
                              ($LOKI_CLIENT_KEY_PATH)
      --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.
                              Can also be set using LOKI_ORG_ID env var.
                              ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;         adds X-Query-Tags http header to API requests.
                              This header value will be part of `metrics.go`
                              statistics. Useful for tracking the query.
                              Can also be set using LOKI_QUERY_TAGS env var.
                              ($LOKI_QUERY_TAGS)
      --[no-]nocache          adds Cache-Control: no-cache http header to API
                              requests. Can also be set using LOKI_NO_CACHE env
                              var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;       adds the Authorization header to API requests for
                              authentication purposes. Can also be set using
                              LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;  adds the Authorization header to API requests
                              for authentication purposes. Can also be
                              set using LOKI_BEARER_TOKEN_FILE env var.
                              ($LOKI_BEARER_TOKEN_FILE)
      --retries=0             How many times to retry each query when
                              getting an error response from Loki. Can also
                              be set using LOKI_CLIENT_RETRIES env var.
                              ($LOKI_CLIENT_RETRIES)
      --min-backoff=0         Minimum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MIN_BACKOFF env var.
                              ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0         Maximum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MAX_BACKOFF env var.
                              ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                              The authorization header used. Can also
                              be set using LOKI_AUTH_HEADER env var.
                              ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;          The http or https proxy to use when
                              making requests. Can also be set
                              using LOKI_HTTP_PROXY_URL env var.
                              ($LOKI_HTTP_PROXY_URL)
      --[no-]compress         Request that Loki compress returned
                              data in transit. Can also be set
                              using LOKI_HTTP_COMPRESSION env var.
                              ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy         Use ProxyFromEnvironment to use net/http
                              ProxyFromEnvironment configuration, eg HTTP_PROXY
                              ($LOKI_ENV_PROXY)
      --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)

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;volume-command-reference&#34;&gt;&lt;code&gt;volume&lt;/code&gt; command reference&lt;/h3&gt;
&lt;p&gt;The output of &lt;code&gt;logcli help volume&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;shell&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-shell&#34;&gt;usage: logcli volume [&amp;lt;flags&amp;gt;] &amp;lt;query&amp;gt;

Run a volume query.

The &amp;#34;volume&amp;#34; command will take the provided label selector(s) and return
aggregate volumes for series matching those volumes. This only works against
Loki instances using the TSDB index format.

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 volume
     --timezone=UTC
     --from=&amp;#34;2021-01-19T10:00:00Z&amp;#34;
     --to=&amp;#34;2021-01-19T20:00:00Z&amp;#34;
     &amp;#39;my-query&amp;#39;


Flags:
      --[no-]help               Show context-sensitive help (also try
                                --help-long and --help-man).
      --[no-]version            Show application version.
  -q, --[no-]quiet              Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                                Specify the format of timestamps in the default
                                output mode [rfc3339, rfc3339nano, rfc822z,
                                rfc1123z, stampmicro, stampmilli, stampnano,
                                unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;             Username for HTTP basic auth. Can also be set
                                using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;             Password for HTTP basic auth. Can also be set
                                using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;              Path to the server Certificate Authority.
                                Can also be set using LOKI_CA_CERT_PATH env var.
                                ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify    Server certificate TLS skip verify. Can also
                                be set using LOKI_TLS_SKIP_VERIFY env var.
                                ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;                 Path to the client certificate. Can also
                                be set using LOKI_CLIENT_CERT_PATH env var.
                                ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                  Path to the client certificate key. Can also
                                be set using LOKI_CLIENT_KEY_PATH env var.
                                ($LOKI_CLIENT_KEY_PATH)
      --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.
                                Can also be set using LOKI_ORG_ID env var.
                                ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;           adds X-Query-Tags http header to API requests.
                                This header value will be part of `metrics.go`
                                statistics. Useful for tracking the query.
                                Can also be set using LOKI_QUERY_TAGS env var.
                                ($LOKI_QUERY_TAGS)
      --[no-]nocache            adds Cache-Control: no-cache http header to API
                                requests. Can also be set using LOKI_NO_CACHE
                                env var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;         adds the Authorization header to API
                                requests for authentication purposes.
                                Can also be set using LOKI_BEARER_TOKEN env var.
                                ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;    adds the Authorization header to API requests
                                for authentication purposes. Can also be
                                set using LOKI_BEARER_TOKEN_FILE env var.
                                ($LOKI_BEARER_TOKEN_FILE)
      --retries=0               How many times to retry each query when
                                getting an error response from Loki. Can also
                                be set using LOKI_CLIENT_RETRIES env var.
                                ($LOKI_CLIENT_RETRIES)
      --min-backoff=0           Minimum backoff time between retries. Can also
                                be set using LOKI_CLIENT_MIN_BACKOFF env var.
                                ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0           Maximum backoff time between retries. Can also
                                be set using LOKI_CLIENT_MAX_BACKOFF env var.
                                ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                                The authorization header used. Can also
                                be set using LOKI_AUTH_HEADER env var.
                                ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;            The http or https proxy to use when
                                making requests. Can also be set
                                using LOKI_HTTP_PROXY_URL env var.
                                ($LOKI_HTTP_PROXY_URL)
      --[no-]compress           Request that Loki compress returned
                                data in transit. Can also be set
                                using LOKI_HTTP_COMPRESSION env var.
                                ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy           Use ProxyFromEnvironment to use net/http
                                ProxyFromEnvironment configuration, eg
                                HTTP_PROXY ($LOKI_ENV_PROXY)
      --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)
      --limit=30                Limit on number of series to return volumes for.
      --targetLabels=TARGETLABELS ...  
                                List of labels to aggregate results into.
      --[no-]aggregateByLabels  Whether to aggregate results by label name only.

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

Run a volume query and return timeseries data.

The &amp;#34;volume_range&amp;#34; command will take the provided label selector(s) and return
aggregate volumes for series matching those volumes, aggregated into buckets
according to the step value. This only works against Loki instances using the
TSDB index format.

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 volume_range
  	   --timezone=UTC
  	   --from=&amp;#34;2021-01-19T10:00:00Z&amp;#34;
  	   --to=&amp;#34;2021-01-19T20:00:00Z&amp;#34;
       --step=1h
  	   &amp;#39;my-query&amp;#39;


Flags:
      --[no-]help               Show context-sensitive help (also try
                                --help-long and --help-man).
      --[no-]version            Show application version.
  -q, --[no-]quiet              Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                                Specify the format of timestamps in the default
                                output mode [rfc3339, rfc3339nano, rfc822z,
                                rfc1123z, stampmicro, stampmilli, stampnano,
                                unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;             Username for HTTP basic auth. Can also be set
                                using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;             Password for HTTP basic auth. Can also be set
                                using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;              Path to the server Certificate Authority.
                                Can also be set using LOKI_CA_CERT_PATH env var.
                                ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify    Server certificate TLS skip verify. Can also
                                be set using LOKI_TLS_SKIP_VERIFY env var.
                                ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;                 Path to the client certificate. Can also
                                be set using LOKI_CLIENT_CERT_PATH env var.
                                ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                  Path to the client certificate key. Can also
                                be set using LOKI_CLIENT_KEY_PATH env var.
                                ($LOKI_CLIENT_KEY_PATH)
      --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.
                                Can also be set using LOKI_ORG_ID env var.
                                ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;           adds X-Query-Tags http header to API requests.
                                This header value will be part of `metrics.go`
                                statistics. Useful for tracking the query.
                                Can also be set using LOKI_QUERY_TAGS env var.
                                ($LOKI_QUERY_TAGS)
      --[no-]nocache            adds Cache-Control: no-cache http header to API
                                requests. Can also be set using LOKI_NO_CACHE
                                env var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;         adds the Authorization header to API
                                requests for authentication purposes.
                                Can also be set using LOKI_BEARER_TOKEN env var.
                                ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;    adds the Authorization header to API requests
                                for authentication purposes. Can also be
                                set using LOKI_BEARER_TOKEN_FILE env var.
                                ($LOKI_BEARER_TOKEN_FILE)
      --retries=0               How many times to retry each query when
                                getting an error response from Loki. Can also
                                be set using LOKI_CLIENT_RETRIES env var.
                                ($LOKI_CLIENT_RETRIES)
      --min-backoff=0           Minimum backoff time between retries. Can also
                                be set using LOKI_CLIENT_MIN_BACKOFF env var.
                                ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0           Maximum backoff time between retries. Can also
                                be set using LOKI_CLIENT_MAX_BACKOFF env var.
                                ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                                The authorization header used. Can also
                                be set using LOKI_AUTH_HEADER env var.
                                ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;            The http or https proxy to use when
                                making requests. Can also be set
                                using LOKI_HTTP_PROXY_URL env var.
                                ($LOKI_HTTP_PROXY_URL)
      --[no-]compress           Request that Loki compress returned
                                data in transit. Can also be set
                                using LOKI_HTTP_COMPRESSION env var.
                                ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy           Use ProxyFromEnvironment to use net/http
                                ProxyFromEnvironment configuration, eg
                                HTTP_PROXY ($LOKI_ENV_PROXY)
      --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)
      --limit=30                Limit on number of series to return volumes for.
      --targetLabels=TARGETLABELS ...  
                                List of labels to aggregate results into.
      --[no-]aggregateByLabels  Whether to aggregate results by label name only.
      --step=1h                 Query resolution step width, roll up volumes
                                into buckets cover step time each.

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

Run a query for detected fields..

The &amp;#34;detected-fields&amp;#34; command will return information about fields detected
using either the &amp;#34;logfmt&amp;#34; or &amp;#34;json&amp;#34; parser against the log lines returned by the
provided query for the provided time range.

The &amp;#34;detected-fields&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 detected-fields
     --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 100 fields by default; use --field-limit to increase.
The query is limited to processing 1000 lines per subquery; use --line-limit to
increase.


Flags:
      --[no-]help             Show context-sensitive help (also try --help-long
                              and --help-man).
      --[no-]version          Show application version.
  -q, --[no-]quiet            Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                              Specify the format of timestamps in the default
                              output mode [rfc3339, rfc3339nano, rfc822z,
                              rfc1123z, stampmicro, stampmilli, stampnano,
                              unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;           Username for HTTP basic auth. Can also be set
                              using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;           Password for HTTP basic auth. Can also be set
                              using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;            Path to the server Certificate Authority.
                              Can also be set using LOKI_CA_CERT_PATH env var.
                              ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify  Server certificate TLS skip verify. Can also
                              be set using LOKI_TLS_SKIP_VERIFY env var.
                              ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;               Path to the client certificate. Can also
                              be set using LOKI_CLIENT_CERT_PATH env var.
                              ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                Path to the client certificate key. Can also
                              be set using LOKI_CLIENT_KEY_PATH env var.
                              ($LOKI_CLIENT_KEY_PATH)
      --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.
                              Can also be set using LOKI_ORG_ID env var.
                              ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;         adds X-Query-Tags http header to API requests.
                              This header value will be part of `metrics.go`
                              statistics. Useful for tracking the query.
                              Can also be set using LOKI_QUERY_TAGS env var.
                              ($LOKI_QUERY_TAGS)
      --[no-]nocache          adds Cache-Control: no-cache http header to API
                              requests. Can also be set using LOKI_NO_CACHE env
                              var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;       adds the Authorization header to API requests for
                              authentication purposes. Can also be set using
                              LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;  adds the Authorization header to API requests
                              for authentication purposes. Can also be
                              set using LOKI_BEARER_TOKEN_FILE env var.
                              ($LOKI_BEARER_TOKEN_FILE)
      --retries=0             How many times to retry each query when
                              getting an error response from Loki. Can also
                              be set using LOKI_CLIENT_RETRIES env var.
                              ($LOKI_CLIENT_RETRIES)
      --min-backoff=0         Minimum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MIN_BACKOFF env var.
                              ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0         Maximum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MAX_BACKOFF env var.
                              ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                              The authorization header used. Can also
                              be set using LOKI_AUTH_HEADER env var.
                              ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;          The http or https proxy to use when
                              making requests. Can also be set
                              using LOKI_HTTP_PROXY_URL env var.
                              ($LOKI_HTTP_PROXY_URL)
      --[no-]compress         Request that Loki compress returned
                              data in transit. Can also be set
                              using LOKI_HTTP_COMPRESSION env var.
                              ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy         Use ProxyFromEnvironment to use net/http
                              ProxyFromEnvironment configuration, eg HTTP_PROXY
                              ($LOKI_ENV_PROXY)
      --limit=100             Limit on number of fields or values to return.
      --line-limit=1000       Limit the number of lines each subquery is allowed
                              to process.
      --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=10s              Query resolution step width, for metric queries.
                              Evaluate the query at the specified step over the
                              time range.

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;
  [&amp;lt;field&amp;gt;]  The name of the field.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;delete-command-reference&#34;&gt;&lt;code&gt;delete&lt;/code&gt; command reference&lt;/h3&gt;
&lt;p&gt;The output of &lt;code&gt;logcli help delete&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;shell&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-shell&#34;&gt;usage: logcli delete &amp;lt;command&amp;gt; [&amp;lt;args&amp;gt; ...]

Manage log deletion requests.


Flags:
      --[no-]help             Show context-sensitive help (also try --help-long
                              and --help-man).
      --[no-]version          Show application version.
  -q, --[no-]quiet            Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                              Specify the format of timestamps in the default
                              output mode [rfc3339, rfc3339nano, rfc822z,
                              rfc1123z, stampmicro, stampmilli, stampnano,
                              unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;           Username for HTTP basic auth. Can also be set
                              using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;           Password for HTTP basic auth. Can also be set
                              using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;            Path to the server Certificate Authority.
                              Can also be set using LOKI_CA_CERT_PATH env var.
                              ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify  Server certificate TLS skip verify. Can also
                              be set using LOKI_TLS_SKIP_VERIFY env var.
                              ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;               Path to the client certificate. Can also
                              be set using LOKI_CLIENT_CERT_PATH env var.
                              ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                Path to the client certificate key. Can also
                              be set using LOKI_CLIENT_KEY_PATH env var.
                              ($LOKI_CLIENT_KEY_PATH)
      --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.
                              Can also be set using LOKI_ORG_ID env var.
                              ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;         adds X-Query-Tags http header to API requests.
                              This header value will be part of `metrics.go`
                              statistics. Useful for tracking the query.
                              Can also be set using LOKI_QUERY_TAGS env var.
                              ($LOKI_QUERY_TAGS)
      --[no-]nocache          adds Cache-Control: no-cache http header to API
                              requests. Can also be set using LOKI_NO_CACHE env
                              var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;       adds the Authorization header to API requests for
                              authentication purposes. Can also be set using
                              LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;  adds the Authorization header to API requests
                              for authentication purposes. Can also be
                              set using LOKI_BEARER_TOKEN_FILE env var.
                              ($LOKI_BEARER_TOKEN_FILE)
      --retries=0             How many times to retry each query when
                              getting an error response from Loki. Can also
                              be set using LOKI_CLIENT_RETRIES env var.
                              ($LOKI_CLIENT_RETRIES)
      --min-backoff=0         Minimum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MIN_BACKOFF env var.
                              ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0         Maximum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MAX_BACKOFF env var.
                              ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                              The authorization header used. Can also
                              be set using LOKI_AUTH_HEADER env var.
                              ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;          The http or https proxy to use when
                              making requests. Can also be set
                              using LOKI_HTTP_PROXY_URL env var.
                              ($LOKI_HTTP_PROXY_URL)
      --[no-]compress         Request that Loki compress returned
                              data in transit. Can also be set
                              using LOKI_HTTP_COMPRESSION env var.
                              ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy         Use ProxyFromEnvironment to use net/http
                              ProxyFromEnvironment configuration, eg HTTP_PROXY
                              ($LOKI_ENV_PROXY)

Subcommands:
delete create [&amp;lt;flags&amp;gt;] &amp;lt;query&amp;gt;
    Create a new log deletion request.

    The &amp;#34;delete create&amp;#34; command creates a new log deletion request for the
    specified query and time range.

    Example:

      logcli delete create &amp;#39;{job=&amp;#34;app&amp;#34;}&amp;#39; --from=&amp;#34;2023-01-01T00:00:00Z&amp;#34; --to=&amp;#34;2023-01-02T00:00:00Z&amp;#34;

delete list
    List existing log deletion requests.

    The &amp;#34;delete list&amp;#34; command lists all existing log deletion requests for the
    tenant.

    Example:

      logcli delete list
      logcli delete list --output=json

delete cancel --request-id=REQUEST-ID [&amp;lt;flags&amp;gt;]
    Cancel a log deletion request.

    The &amp;#34;delete cancel&amp;#34; command cancels an existing log deletion request by ID.

    Example:

      logcli delete cancel --request-id=&amp;#34;abc123&amp;#34;
      logcli delete cancel --request-id=&amp;#34;abc123&amp;#34; --force&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;delete-create-command-reference&#34;&gt;&lt;code&gt;delete create&lt;/code&gt; command reference&lt;/h3&gt;
&lt;p&gt;The output of &lt;code&gt;logcli help delete create&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;shell&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-shell&#34;&gt;usage: logcli delete create [&amp;lt;flags&amp;gt;] &amp;lt;query&amp;gt;

Create a new log deletion request.

The &amp;#34;delete create&amp;#34; command creates a new log deletion request for the specified
query and time range.

Example:

  logcli delete create &amp;#39;{job=&amp;#34;app&amp;#34;}&amp;#39; --from=&amp;#34;2023-01-01T00:00:00Z&amp;#34; --to=&amp;#34;2023-01-02T00:00:00Z&amp;#34;


Flags:
      --[no-]help             Show context-sensitive help (also try --help-long
                              and --help-man).
      --[no-]version          Show application version.
  -q, --[no-]quiet            Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                              Specify the format of timestamps in the default
                              output mode [rfc3339, rfc3339nano, rfc822z,
                              rfc1123z, stampmicro, stampmilli, stampnano,
                              unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;           Username for HTTP basic auth. Can also be set
                              using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;           Password for HTTP basic auth. Can also be set
                              using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;            Path to the server Certificate Authority.
                              Can also be set using LOKI_CA_CERT_PATH env var.
                              ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify  Server certificate TLS skip verify. Can also
                              be set using LOKI_TLS_SKIP_VERIFY env var.
                              ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;               Path to the client certificate. Can also
                              be set using LOKI_CLIENT_CERT_PATH env var.
                              ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                Path to the client certificate key. Can also
                              be set using LOKI_CLIENT_KEY_PATH env var.
                              ($LOKI_CLIENT_KEY_PATH)
      --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.
                              Can also be set using LOKI_ORG_ID env var.
                              ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;         adds X-Query-Tags http header to API requests.
                              This header value will be part of `metrics.go`
                              statistics. Useful for tracking the query.
                              Can also be set using LOKI_QUERY_TAGS env var.
                              ($LOKI_QUERY_TAGS)
      --[no-]nocache          adds Cache-Control: no-cache http header to API
                              requests. Can also be set using LOKI_NO_CACHE env
                              var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;       adds the Authorization header to API requests for
                              authentication purposes. Can also be set using
                              LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;  adds the Authorization header to API requests
                              for authentication purposes. Can also be
                              set using LOKI_BEARER_TOKEN_FILE env var.
                              ($LOKI_BEARER_TOKEN_FILE)
      --retries=0             How many times to retry each query when
                              getting an error response from Loki. Can also
                              be set using LOKI_CLIENT_RETRIES env var.
                              ($LOKI_CLIENT_RETRIES)
      --min-backoff=0         Minimum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MIN_BACKOFF env var.
                              ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0         Maximum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MAX_BACKOFF env var.
                              ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                              The authorization header used. Can also
                              be set using LOKI_AUTH_HEADER env var.
                              ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;          The http or https proxy to use when
                              making requests. Can also be set
                              using LOKI_HTTP_PROXY_URL env var.
                              ($LOKI_HTTP_PROXY_URL)
      --[no-]compress         Request that Loki compress returned
                              data in transit. Can also be set
                              using LOKI_HTTP_COMPRESSION env var.
                              ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy         Use ProxyFromEnvironment to use net/http
                              ProxyFromEnvironment configuration, eg HTTP_PROXY
                              ($LOKI_ENV_PROXY)
      --since=1h              Lookback window.
      --from=FROM             Start time for deletion (inclusive)
      --to=TO                 End time for deletion (exclusive)
      --max-interval=MAX-INTERVAL  
                              Maximum time interval for delete request

Args:
  &amp;lt;query&amp;gt;  LogQL query to match log lines for deletion (e.g. &amp;#39;{job=&amp;#34;app&amp;#34;}&amp;#39;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;delete-list-command-reference&#34;&gt;&lt;code&gt;delete list&lt;/code&gt; command reference&lt;/h3&gt;
&lt;p&gt;The output of &lt;code&gt;logcli help delete list&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;shell&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-shell&#34;&gt;usage: logcli delete list

List existing log deletion requests.

The &amp;#34;delete list&amp;#34; command lists all existing log deletion requests for the
tenant.

Example:

  logcli delete list
  logcli delete list --output=json


Flags:
      --[no-]help             Show context-sensitive help (also try --help-long
                              and --help-man).
      --[no-]version          Show application version.
  -q, --[no-]quiet            Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                              Specify the format of timestamps in the default
                              output mode [rfc3339, rfc3339nano, rfc822z,
                              rfc1123z, stampmicro, stampmilli, stampnano,
                              unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;           Username for HTTP basic auth. Can also be set
                              using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;           Password for HTTP basic auth. Can also be set
                              using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;            Path to the server Certificate Authority.
                              Can also be set using LOKI_CA_CERT_PATH env var.
                              ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify  Server certificate TLS skip verify. Can also
                              be set using LOKI_TLS_SKIP_VERIFY env var.
                              ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;               Path to the client certificate. Can also
                              be set using LOKI_CLIENT_CERT_PATH env var.
                              ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                Path to the client certificate key. Can also
                              be set using LOKI_CLIENT_KEY_PATH env var.
                              ($LOKI_CLIENT_KEY_PATH)
      --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.
                              Can also be set using LOKI_ORG_ID env var.
                              ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;         adds X-Query-Tags http header to API requests.
                              This header value will be part of `metrics.go`
                              statistics. Useful for tracking the query.
                              Can also be set using LOKI_QUERY_TAGS env var.
                              ($LOKI_QUERY_TAGS)
      --[no-]nocache          adds Cache-Control: no-cache http header to API
                              requests. Can also be set using LOKI_NO_CACHE env
                              var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;       adds the Authorization header to API requests for
                              authentication purposes. Can also be set using
                              LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;  adds the Authorization header to API requests
                              for authentication purposes. Can also be
                              set using LOKI_BEARER_TOKEN_FILE env var.
                              ($LOKI_BEARER_TOKEN_FILE)
      --retries=0             How many times to retry each query when
                              getting an error response from Loki. Can also
                              be set using LOKI_CLIENT_RETRIES env var.
                              ($LOKI_CLIENT_RETRIES)
      --min-backoff=0         Minimum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MIN_BACKOFF env var.
                              ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0         Maximum backoff time between retries. Can also
                              be set using LOKI_CLIENT_MAX_BACKOFF env var.
                              ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                              The authorization header used. Can also
                              be set using LOKI_AUTH_HEADER env var.
                              ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;          The http or https proxy to use when
                              making requests. Can also be set
                              using LOKI_HTTP_PROXY_URL env var.
                              ($LOKI_HTTP_PROXY_URL)
      --[no-]compress         Request that Loki compress returned
                              data in transit. Can also be set
                              using LOKI_HTTP_COMPRESSION env var.
                              ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy         Use ProxyFromEnvironment to use net/http
                              ProxyFromEnvironment configuration, eg HTTP_PROXY
                              ($LOKI_ENV_PROXY)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;delete-cancel-command-reference&#34;&gt;&lt;code&gt;delete cancel&lt;/code&gt; command reference&lt;/h3&gt;
&lt;p&gt;The output of &lt;code&gt;logcli help delete cancel&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;shell&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-shell&#34;&gt;usage: logcli delete cancel --request-id=REQUEST-ID [&amp;lt;flags&amp;gt;]

Cancel a log deletion request.

The &amp;#34;delete cancel&amp;#34; command cancels an existing log deletion request by ID.

Example:

  logcli delete cancel --request-id=&amp;#34;abc123&amp;#34;
  logcli delete cancel --request-id=&amp;#34;abc123&amp;#34; --force


Flags:
      --[no-]help              Show context-sensitive help (also try --help-long
                               and --help-man).
      --[no-]version           Show application version.
  -q, --[no-]quiet             Suppress query metadata
      --[no-]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]
      --output-timestamp-format=rfc3339  
                               Specify the format of timestamps in the default
                               output mode [rfc3339, rfc3339nano, rfc822z,
                               rfc1123z, stampmicro, stampmilli, stampnano,
                               unixdate]
      --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.
      --[no-]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. ($LOKI_ADDR)
      --username=&amp;#34;&amp;#34;            Username for HTTP basic auth. Can also be set
                               using LOKI_USERNAME env var. ($LOKI_USERNAME)
      --password=&amp;#34;&amp;#34;            Password for HTTP basic auth. Can also be set
                               using LOKI_PASSWORD env var. ($LOKI_PASSWORD)
      --ca-cert=&amp;#34;&amp;#34;             Path to the server Certificate Authority.
                               Can also be set using LOKI_CA_CERT_PATH env var.
                               ($LOKI_CA_CERT_PATH)
      --[no-]tls-skip-verify   Server certificate TLS skip verify. Can also
                               be set using LOKI_TLS_SKIP_VERIFY env var.
                               ($LOKI_TLS_SKIP_VERIFY)
      --cert=&amp;#34;&amp;#34;                Path to the client certificate. Can also
                               be set using LOKI_CLIENT_CERT_PATH env var.
                               ($LOKI_CLIENT_CERT_PATH)
      --key=&amp;#34;&amp;#34;                 Path to the client certificate key. Can also
                               be set using LOKI_CLIENT_KEY_PATH env var.
                               ($LOKI_CLIENT_KEY_PATH)
      --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.
                               Can also be set using LOKI_ORG_ID env var.
                               ($LOKI_ORG_ID)
      --query-tags=&amp;#34;&amp;#34;          adds X-Query-Tags http header to API requests.
                               This header value will be part of `metrics.go`
                               statistics. Useful for tracking the query.
                               Can also be set using LOKI_QUERY_TAGS env var.
                               ($LOKI_QUERY_TAGS)
      --[no-]nocache           adds Cache-Control: no-cache http header to API
                               requests. Can also be set using LOKI_NO_CACHE env
                               var. ($LOKI_NO_CACHE)
      --bearer-token=&amp;#34;&amp;#34;        adds the Authorization header to API requests for
                               authentication purposes. Can also be set using
                               LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN)
      --bearer-token-file=&amp;#34;&amp;#34;   adds the Authorization header to API requests
                               for authentication purposes. Can also be
                               set using LOKI_BEARER_TOKEN_FILE env var.
                               ($LOKI_BEARER_TOKEN_FILE)
      --retries=0              How many times to retry each query when
                               getting an error response from Loki. Can also
                               be set using LOKI_CLIENT_RETRIES env var.
                               ($LOKI_CLIENT_RETRIES)
      --min-backoff=0          Minimum backoff time between retries. Can also
                               be set using LOKI_CLIENT_MIN_BACKOFF env var.
                               ($LOKI_CLIENT_MIN_BACKOFF)
      --max-backoff=0          Maximum backoff time between retries. Can also
                               be set using LOKI_CLIENT_MAX_BACKOFF env var.
                               ($LOKI_CLIENT_MAX_BACKOFF)
      --auth-header=&amp;#34;Authorization&amp;#34;  
                               The authorization header used. Can also
                               be set using LOKI_AUTH_HEADER env var.
                               ($LOKI_AUTH_HEADER)
      --proxy-url=&amp;#34;&amp;#34;           The http or https proxy to use when
                               making requests. Can also be set
                               using LOKI_HTTP_PROXY_URL env var.
                               ($LOKI_HTTP_PROXY_URL)
      --[no-]compress          Request that Loki compress returned
                               data in transit. Can also be set
                               using LOKI_HTTP_COMPRESSION env var.
                               ($LOKI_HTTP_COMPRESSION)
      --[no-]envproxy          Use ProxyFromEnvironment to use net/http
                               ProxyFromEnvironment configuration, eg HTTP_PROXY
                               ($LOKI_ENV_PROXY)
      --request-id=REQUEST-ID  ID of the delete request to cancel
      --[no-]force             Force cancellation of partially completed request&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;use---stdin-to-query-locally&#34;&gt;Use &lt;code&gt;--stdin&lt;/code&gt; to query locally&lt;/h3&gt;
&lt;p&gt;You can use the logcli &lt;code&gt;–stdin&lt;/code&gt; argument to run a command against a log file on your local machine, instead of a Loki instance. This lets you use LogQL to query a local log file without having to load the file into Loki, for example if you have downloaded a log file and want to query it outside of Loki.&lt;/p&gt;
&lt;p&gt;If you have log files in your local machine, and just want to run some LogQL queries against those log files, &lt;code&gt;--stdin&lt;/code&gt; flag can help.&lt;/p&gt;
&lt;p&gt;You may use &lt;code&gt;stdin&lt;/code&gt; flag to do the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use as a quick way to test or validate a LogQL expression against some log data.&lt;/li&gt;
&lt;li&gt;Learn the basics of LogQL with just local log files and the &lt;code&gt;logcli&lt;/code&gt; tool (without needing to set up Loki servers, Grafana, etc.).&lt;/li&gt;
&lt;li&gt;Enable troubleshooting by letting you run queries without accessing a Loki instance.&lt;/li&gt;
&lt;li&gt;Use LogQL to parse and extract data from a local log file without ingesting the data into Loki.&lt;/li&gt;
&lt;li&gt;Enable discussion on public forums, for example submitting questions and answers, and sharing LogQL expressions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;notes-on-stdin-usage&#34;&gt;Notes on &lt;code&gt;stdin&lt;/code&gt; usage&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;The &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;. So the stream selector in the query is optional, for example, 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;/ol&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;Currently &lt;code&gt;stdin&lt;/code&gt; doesn&amp;rsquo;t support any type of metric queries.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h4 id=&#34;stdin-examples&#34;&gt;&lt;code&gt;stdin&lt;/code&gt; examples&lt;/h4&gt;
&lt;ul&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;/ul&gt;
&lt;h2 id=&#34;batching&#34;&gt;Batching&lt;/h2&gt;
&lt;p&gt;logcli sends queries to Loki in such a way 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 limits the total number of log lines that will be returned for a single query.
When not set, &lt;code&gt;--limit&lt;/code&gt; defaults to 30.
The limit protects the user from overwhelming Loki in cases where the specified query would have returned a large number of log lines.
The limit also protects the user from unexpectedly large responses.&lt;/p&gt;
&lt;p&gt;Larger result sets can be batched for easier consumption. Use the &lt;code&gt;--batch&lt;/code&gt; option to control the number of log line results that are returned in each batch.
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 will cause the
requests from logcli to Loki to be batched.&lt;/p&gt;
&lt;p&gt;When you run a query in Loki, it will return up to a certain number of log lines. By default, this limit is 5000 lines. You can configure this server limit with the &lt;code&gt;limits_config.max_entries_limit_per_query&lt;/code&gt; in Loki&amp;rsquo;s configuration.&lt;/p&gt;
&lt;p&gt;Batching lets you query for a results set that is larger than this 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.
To suppress the output of the query metadata, set the &lt;code&gt;--quiet&lt;/code&gt; option on the &lt;code&gt;logcli query&lt;/code&gt; command line.&lt;/p&gt;
&lt;h2 id=&#34;logcli-example-queries&#34;&gt;logcli example queries&lt;/h2&gt;
&lt;p&gt;Here are some examples of logcli.&lt;/p&gt;
&lt;p&gt;Find all values for a label.&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;logcli labels job&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;https://logs-dev-ops-tools1.grafana.net/api/prom/label/job/values
loki-ops/consul
loki-ops/loki-gw&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Print all labels and their unique values. This command is especially useful for finding 
    &lt;a href=&#34;/docs/loki/v3.7.x/get-started/labels/#cardinality&#34;&gt;high-cardinality labels&lt;/a&gt; in the index.&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;logcli series &amp;#39;{cluster=&amp;#34;vinson&amp;#34;}&amp;#39; --analyze-labels&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;2024/10/31 13:46:25 https://logs-prod-008.grafana.net/loki/api/v1/series?end=1730382385746344416&amp;amp;match=%7Bcluster%3D%22vinson%22%7D&amp;amp;start=1730378785746344416
Total Streams:  10
Unique Labels:  10

Label Name       Unique Values  Found In Streams
service_name        8          10
pod                 7          7
job                 6          10
app_kubernetes_io_name  6          6
container           5          7
namespace           3          10
stream              2          7
flags               1          7
instance            1          3
cluster             1          10&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Get all logs for a given stream&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;logcli query &amp;#39;{job=&amp;#34;loki-ops/consul&amp;#34;}&amp;#39;&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;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&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Print all log streams for the given stream selector. This example shows all known label combinations that match your 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;logcli series -q --match=&amp;#39;{namespace=&amp;#34;loki&amp;#34;,container_name=&amp;#34;loki&amp;#34;}&amp;#39;&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;{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;p&gt;Delete all logs for a specific job within a time range:&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;logcli delete create &amp;#39;{job=&amp;#34;app&amp;#34;}&amp;#39; --from=&amp;#34;2023-01-01T00:00:00Z&amp;#34; --to=&amp;#34;2023-01-02T00:00:00Z&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;List all deletion 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;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 delete list&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Cancel a specific deletion request:&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;logcli delete cancel --request-id=&amp;#34;abc123&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;troubleshoot-logcli&#34;&gt;Troubleshoot logcli&lt;/h2&gt;
&lt;p&gt;Make sure that the version of Logcli you are using matches your Loki version.
You can check your logcli version with the following command:&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;logcli –version&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you experience timeouts, you can update the following setting in your &lt;code&gt;logcli-config.yaml&lt;/code&gt; 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;limits_config:
  query_timeout: 10m&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="logcli-getting-started">LogCLI getting started&lt;/h1>
&lt;p>logcli is a command-line client for Loki that lets you run
&lt;a href="/docs/loki/v3.7.x/query/">LogQL&lt;/a> queries against your Loki instance. The &lt;code>query&lt;/code> 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.&lt;/p></description></item><item><title>LogCLI tutorial</title><link>https://grafana.com/docs/loki/v3.7.x/query/logcli/logcli-tutorial/</link><pubDate>Thu, 09 Apr 2026 02:28:18 +0000</pubDate><guid>https://grafana.com/docs/loki/v3.7.x/query/logcli/logcli-tutorial/</guid><content><![CDATA[&lt;!-- INTERACTIVE page intro.md START --&gt;
&lt;h1 id=&#34;logcli-tutorial&#34;&gt;LogCLI tutorial&lt;/h1&gt;
&lt;p&gt;This 
    &lt;a href=&#34;/docs/loki/v3.7.x/query/logcli/&#34;&gt;LogCLI&lt;/a&gt; tutorial will walk you through the following concepts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Querying logs&lt;/li&gt;
&lt;li&gt;Meta Queries against your Loki instance&lt;/li&gt;
&lt;li&gt;Queries against static log files&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- INTERACTIVE ignore START --&gt;
&lt;h2 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;Before you begin, you need to have the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;Docker-compose&lt;/li&gt;
&lt;li&gt;LogCLI installed on your machine (see 
    &lt;a href=&#34;/docs/loki/v3.7.x/query/logcli/getting-started/#installation&#34;&gt;LogCLI installation&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-tip&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Tip&lt;/p&gt;&lt;p&gt;Alternatively, you can try out this example in our interactive learning environment: &lt;a href=&#34;https://killercoda.com/grafana-labs/course/loki/logcli-tutorial&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;LogCLI Tutorial&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s a fully configured environment with all the dependencies already installed.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/loki/loki-ile.svg&#34;
  alt=&#34;Interactive&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Provide feedback, report bugs, and raise issues in the &lt;a href=&#34;https://github.com/grafana/killercoda&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Killercoda repository&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;!-- INTERACTIVE ignore END --&gt;
&lt;h2 id=&#34;scenario&#34;&gt;Scenario&lt;/h2&gt;
&lt;p&gt;You are a site manager for a new logistics company. The company uses structured logs to keep track of every shipment sent and received. The payload format looks like this:&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;timestamp&amp;#34;: &amp;#34;2024-11-22T13:22:56.377884&amp;#34;, &amp;#34;state&amp;#34;: &amp;#34;New York&amp;#34;, &amp;#34;city&amp;#34;: &amp;#34;Buffalo&amp;#34;, &amp;#34;package_id&amp;#34;: &amp;#34;PKG34245&amp;#34;, &amp;#34;package_type&amp;#34;: &amp;#34;Documents&amp;#34;, &amp;#34;package_size&amp;#34;: &amp;#34;Medium&amp;#34;, &amp;#34;package_status&amp;#34;: &amp;#34;error&amp;#34;, &amp;#34;note&amp;#34;: &amp;#34;Out for delivery&amp;#34;, &amp;#34;sender&amp;#34;: {&amp;#34;name&amp;#34;: &amp;#34;Sender27&amp;#34;, &amp;#34;address&amp;#34;: &amp;#34;144 Elm St, Buffalo, New York&amp;#34;}, &amp;#34;receiver&amp;#34;: {&amp;#34;name&amp;#34;: &amp;#34;Receiver4&amp;#34;, &amp;#34;address&amp;#34;: &amp;#34;260 Cedar Blvd, New York City, New York&amp;#34;}}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The logs are processed from Grafana Alloy to extract labels and structured metadata before they&amp;rsquo;re stored in Loki. You have been tasked with monitoring the logs using the LogCLI and build a report on the overall health of the shipments.&lt;/p&gt;
&lt;!-- INTERACTIVE page intro.md END --&gt;
&lt;!-- INTERACTIVE page step1.md START --&gt;
&lt;h2 id=&#34;setup&#34;&gt;Setup&lt;/h2&gt;
&lt;p&gt;To get started, we need to clone the &lt;a href=&#34;https://github.com/grafana/alloy-scenarios&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Alloy Scenario&lt;/a&gt; repository and start the mail-house example:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Clone the repository:

&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/alloy-scenarios.git&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Start the mail-house example:

&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;docker compose -f alloy-scenarios/mail-house/docker-compose.yml up -d&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This will start the mail-house example and expose the Loki instance at &lt;a href=&#34;http://localhost:3100&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;http://localhost:3100&lt;/code&gt;&lt;/a&gt;. We have also included a Grafana instance to verify the LogCLI results which can be accessed at &lt;a href=&#34;http://localhost:3000&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;http://localhost:3000&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;connecting-logcli-to-loki&#34;&gt;Connecting LogCLI to Loki&lt;/h3&gt;
&lt;p&gt;To connect LogCLI to the Loki instance, you need to set the &lt;code&gt;LOKI_ADDR&lt;/code&gt; environment variable:&lt;/p&gt;


&lt;div class=&#34;admonition admonition-tip&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Tip&lt;/p&gt;&lt;p&gt;If you are running this example against your own Loki instance and have configured authentication, you will also need to set the &lt;code&gt;LOKI_USERNAME&lt;/code&gt; and &lt;code&gt;LOKI_PASSWORD&lt;/code&gt; environment variables.&lt;/p&gt;&lt;/blockquote&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;export LOKI_ADDR=http://localhost:3100&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now let&amp;rsquo;s verify the connection by running the following command:&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;logcli labels&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This should return an output similar to the following:&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;console&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-console&#34;&gt;http://localhost:3100/loki/api/v1/labels?end=1732282703894072000&amp;amp;start=1732279103894072000
package_size
service_name
state&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This confirms that LogCLI is connected to the Loki instance and we now know that the logs contain the following labels: &lt;code&gt;package_size&lt;/code&gt;, &lt;code&gt;service_name&lt;/code&gt;, and &lt;code&gt;state&lt;/code&gt;. Let&amp;rsquo;s run some queries against Loki to better understand our package logistics.&lt;/p&gt;
&lt;!-- INTERACTIVE page step1.md END --&gt;
&lt;!-- INTERACTIVE page step2.md START --&gt;
&lt;h2 id=&#34;querying-logs&#34;&gt;Querying logs&lt;/h2&gt;
&lt;p&gt;As part of our role within the logistics company, we need to build a report on the overall health of the shipments. Unfortunately, we only have access to a console and cannot use Grafana to visualize the data. We can use LogCLI to query the logs and build the report.&lt;/p&gt;
&lt;h3 id=&#34;find-all-critical-packages&#34;&gt;Find all critical packages&lt;/h3&gt;
&lt;p&gt;To find all critical packages in the last hour (the default lookback time), we can run the following 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;logcli query &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;} | package_status=&amp;#34;critical&amp;#34;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will return all logs where the &lt;code&gt;service_name&lt;/code&gt; is &lt;code&gt;Delivery World&lt;/code&gt; and the &lt;code&gt;package_status&lt;/code&gt; is &lt;code&gt;critical&lt;/code&gt;. The output will look similar to the following:&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;console&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-console&#34;&gt;http://localhost:3100/loki/api/v1/query_range?direction=BACKWARD&amp;amp;end=1732617594381712000&amp;amp;limit=30&amp;amp;query=%7Bservice_name%3D%22Delivery&amp;#43;World%22%7D&amp;#43;%7C&amp;#43;package_status%3D%22critical%22&amp;amp;start=1732613994381712000
Common labels: {package_status=&amp;#34;critical&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;}
2024-11-26T10:39:52Z {package_id=&amp;#34;PKG79755&amp;#34;, package_size=&amp;#34;Small&amp;#34;, state=&amp;#34;Texas&amp;#34;}       {&amp;#34;timestamp&amp;#34;: &amp;#34;2024-11-26T10:39:52.521602Z&amp;#34;, &amp;#34;state&amp;#34;: &amp;#34;Texas&amp;#34;, &amp;#34;city&amp;#34;: &amp;#34;Dallas&amp;#34;, &amp;#34;package_id&amp;#34;: &amp;#34;PKG79755&amp;#34;, &amp;#34;package_type&amp;#34;: &amp;#34;Clothing&amp;#34;, &amp;#34;package_size&amp;#34;: &amp;#34;Small&amp;#34;, &amp;#34;package_status&amp;#34;: &amp;#34;critical&amp;#34;, &amp;#34;note&amp;#34;: &amp;#34;In transit&amp;#34;, &amp;#34;sender&amp;#34;: {&amp;#34;name&amp;#34;: &amp;#34;Sender38&amp;#34;, &amp;#34;address&amp;#34;: &amp;#34;906 Maple Ave, Dallas, Texas&amp;#34;}, &amp;#34;receiver&amp;#34;: {&amp;#34;name&amp;#34;: &amp;#34;Receiver41&amp;#34;, &amp;#34;address&amp;#34;: &amp;#34;455 Pine Rd, Dallas, Texas&amp;#34;}}
2024-11-26T10:39:50Z {package_id=&amp;#34;PKG34018&amp;#34;, package_size=&amp;#34;Large&amp;#34;, state=&amp;#34;Illinois&amp;#34;}    {&amp;#34;timestamp&amp;#34;: &amp;#34;2024-11-26T10:39:50.510841Z&amp;#34;, &amp;#34;state&amp;#34;: &amp;#34;Illinois&amp;#34;, &amp;#34;city&amp;#34;: &amp;#34;Chicago&amp;#34;, &amp;#34;package_id&amp;#34;: &amp;#34;PKG34018&amp;#34;, &amp;#34;package_type&amp;#34;: &amp;#34;Clothing&amp;#34;, &amp;#34;package_size&amp;#34;: &amp;#34;Large&amp;#34;, &amp;#34;package_status&amp;#34;: &amp;#34;critical&amp;#34;, &amp;#34;note&amp;#34;: &amp;#34;Delayed due to weather&amp;#34;, &amp;#34;sender&amp;#34;: {&amp;#34;name&amp;#34;: &amp;#34;Sender22&amp;#34;, &amp;#34;address&amp;#34;: &amp;#34;758 Elm St, Chicago, Illinois&amp;#34;}, &amp;#34;receiver&amp;#34;: {&amp;#34;name&amp;#34;: &amp;#34;Receiver10&amp;#34;, &amp;#34;address&amp;#34;: &amp;#34;441 Cedar Blvd, Naperville, Illinois&amp;#34;}}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Lets suppose we want to look back for the last 24 hours, we can use the &lt;code&gt;--since&lt;/code&gt; flag to specify the time range:&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;logcli query --since 24h &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;} | package_status=&amp;#34;critical&amp;#34;&amp;#39; &lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will query all logs for the &lt;code&gt;package_status&lt;/code&gt; &lt;code&gt;critical&lt;/code&gt; in the last 24 hours. However it will not return all of the logs, but only the first 30 logs. We can use the &lt;code&gt;--limit&lt;/code&gt; flag to specify the number of logs to return:&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;logcli query --since 24h --limit 100 &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;} | package_status=&amp;#34;critical&amp;#34;&amp;#39; &lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;metric-queries&#34;&gt;Metric queries&lt;/h3&gt;
&lt;p&gt;We can also use LogCLI to query logs based on metrics. For instance as part of the site report we want to count the total number of packages sent from California in the last 24 hours in 1 hour intervals. We can use the following 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;logcli query --since 24h &amp;#39;sum(count_over_time({state=&amp;#34;California&amp;#34;}[1h]))&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will return a JSON object containing a list of timestamps (Unix format) and the number of packages sent from California in 1 hour intervals. Since we summing the count of logs over time, we will see the total number of logs steadily increase over time. The output will look similar to the following:&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;console&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-console&#34;&gt;[
  {
    &amp;#34;metric&amp;#34;: {},
    &amp;#34;values&amp;#34;: [
      [
        1733913765,
        &amp;#34;46&amp;#34;
      ],
      [
        1733914110,
        &amp;#34;114&amp;#34;
      ],
      [
        1733914455,
        &amp;#34;179&amp;#34;
      ],
      [
        1733914800,
        &amp;#34;250&amp;#34;
      ],
      [
        1733915145,
        &amp;#34;318&amp;#34;
      ],
      [
        1733915490,
        &amp;#34;392&amp;#34;
      ],
      [
        1733915835,
        &amp;#34;396&amp;#34;
      ]
    ]
  }
]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;We can take this a step further and filter the logs based on the &lt;code&gt;package_type&lt;/code&gt; label. For instance, we can count the number of documents sent from California in the last 24 hours in 1 hour intervals:&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;logcli query --since 24h  &amp;#39;sum(count_over_time({state=&amp;#34;California&amp;#34;}| json | package_type= &amp;#34;Documents&amp;#34; [1h]))&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will return a similar JSON object above but will only show a trend of the number of documents sent from California in 1 hour intervals.&lt;/p&gt;
&lt;h3 id=&#34;instant-metric-queries&#34;&gt;Instant metric queries&lt;/h3&gt;
&lt;p&gt;Instant metric queries are a subset of metric queries that return the value of the metric at a specific point in time. This can be useful for quickly understanding an aggregate state of the stored logs.&lt;/p&gt;
&lt;p&gt;For instance, we can use the following query to get the number of packages sent from California in the last 5 minutes:&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;logcli instant-query &amp;#39;sum(count_over_time({state=&amp;#34;California&amp;#34;}[5m]))&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will return a result similar to the following:&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;console&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-console&#34;&gt;[
  {
    &amp;#34;metric&amp;#34;: {},
    &amp;#34;value&amp;#34;: [
      1732702998.725,
      &amp;#34;58&amp;#34;
    ]
  }
]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;writing-query-results-to-a-file&#34;&gt;Writing query results to a file&lt;/h3&gt;
&lt;p&gt;Another useful feature of LogCLI is the ability to write the query results to a file. This can be useful for downloading the results of our inventory report:&lt;/p&gt;
&lt;p&gt;First we need to create a directory to store the logs:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;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;mkdir -p ./inventory&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Next we can run the following query to write the logs to the &lt;code&gt;./inventory&lt;/code&gt; directory:&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;  logcli query \
     --timezone=UTC \
     --output=jsonl \
     --parallel-duration=&amp;#34;12h&amp;#34; \
     --parallel-max-workers=&amp;#34;4&amp;#34; \
     --part-path-prefix=&amp;#34;./inventory/inv&amp;#34; \
     --since=24h \
     &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will write all logs for the &lt;code&gt;service_name&lt;/code&gt; &lt;code&gt;Delivery World&lt;/code&gt; in the last 24 hours to the &lt;code&gt;./inventory&lt;/code&gt; directory. The logs will be split into two files, each containing 12 hours of logs. Note that we do not need to specify &lt;code&gt;--limit&lt;/code&gt; as this is overridden by the &lt;code&gt;--parallel-duration&lt;/code&gt; flag.&lt;/p&gt;
&lt;!-- INTERACTIVE page step2.md END --&gt;
&lt;!-- INTERACTIVE page step3.md START --&gt;
&lt;h2 id=&#34;meta-queries&#34;&gt;Meta queries&lt;/h2&gt;
&lt;p&gt;As site managers, it&amp;rsquo;s essential to maintain good data hygiene and ensure Loki operates efficiently. Understanding the labels and log volume in your logs plays a key role in this process. Beyond querying logs, LogCLI also supports meta queries on your Loki instance. Meta queries don&amp;rsquo;t return log data but provide insights into the structure of your logs and the performance of your queries. The following examples demonstrate some of the core meta queries we run internally to better understand how a Loki instance is performing.&lt;/p&gt;
&lt;h3 id=&#34;checking-series-cardinality&#34;&gt;Checking series cardinality&lt;/h3&gt;
&lt;p&gt;One of the most important aspects of keeping Loki healthy is to monitor the series cardinality. This is the number of unique series in your logs. A high series cardinality can lead to performance issues and increased storage costs. We can use LogCLI to check the series cardinality of our logs.&lt;/p&gt;
&lt;p&gt;To start let&amp;rsquo;s print how many unique series we have in our logs:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;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 series &amp;#39;{}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will return a list of all the unique series in our logs. The output will look similar to the following:&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;console&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-console&#34;&gt;{package_size=&amp;#34;Small&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;Florida&amp;#34;}
{package_size=&amp;#34;Medium&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;Florida&amp;#34;}
{package_size=&amp;#34;Small&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;California&amp;#34;}
{package_size=&amp;#34;Large&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;New York&amp;#34;}
{package_size=&amp;#34;Small&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;Illinois&amp;#34;}
{package_size=&amp;#34;Large&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;Florida&amp;#34;}
{package_size=&amp;#34;Medium&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;Illinois&amp;#34;}
{package_size=&amp;#34;Large&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;Texas&amp;#34;}
{package_size=&amp;#34;Medium&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;California&amp;#34;}
{package_size=&amp;#34;Medium&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;Texas&amp;#34;}
{package_size=&amp;#34;Small&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;Texas&amp;#34;}
{package_size=&amp;#34;Large&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;Illinois&amp;#34;}
{package_size=&amp;#34;Small&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;New York&amp;#34;}
{package_size=&amp;#34;Medium&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;New York&amp;#34;}
{package_size=&amp;#34;Large&amp;#34;, service_name=&amp;#34;Delivery World&amp;#34;, state=&amp;#34;California&amp;#34;}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;We can further improve this query by adding &lt;code&gt;--analyze-labels&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;logcli series &amp;#39;{}&amp;#39; --analyze-labels&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will return a summary of the unique values for each label in our logs. The output will look similar to the following:&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;console&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-console&#34;&gt;Label Name    Unique Values  Found In Streams
state         5              15
package_size  3              15
service_name  1              15&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;detected-fields&#34;&gt;Detected fields&lt;/h3&gt;
&lt;p&gt;Another useful feature of LogCLI is the ability to detect fields in your logs. This can be useful for understanding the structure of your logs and the keys that are present. This will let us detect keys which could be promoted to labels or to structured metadata.&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;logcli detected-fields --since 24h &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will return a list of all the keys detected in our logs. The output will look similar to the following:&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;console&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-console&#34;&gt;label: city                   type: string  cardinality: 15
label: detected_level         type: string  cardinality: 3
label: note                   type: string  cardinality: 7
label: package_id             type: string  cardinality: 994
label: package_size_extracted type: string  cardinality: 3
label: package_status         type: string  cardinality: 4
label: package_type           type: string  cardinality: 5
label: receiver_address       type: string  cardinality: 991
label: receiver_name          type: string  cardinality: 100
label: sender_address         type: string  cardinality: 991
label: sender_name            type: string  cardinality: 100
label: state_extracted        type: string  cardinality: 5
label: timestamp              type: string  cardinality: 1000&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can now see why we opted to keep &lt;code&gt;package_id&lt;/code&gt; in structured metadata and &lt;code&gt;package_size&lt;/code&gt; as a label. Package ID has a high cardinality and is unique to each log entry, making it a good candidate for structured metadata since we potentially may need to query for it directly. Package size, on the other hand, has a low cardinality, making it a good candidate for a label.&lt;/p&gt;
&lt;h3 id=&#34;checking-query-performance&#34;&gt;Checking query performance&lt;/h3&gt;
&lt;p&gt;Another important aspect of keeping Loki healthy is to monitor the query performance. We can use LogCLI to check the query performance of our logs.&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;The LogCLI can only return statistics for queries that touch object storage. In this example we force the Loki ingesters to flush chunks every 5 minutes which isn&amp;rsquo;t recommended for production use. When running this demo if you don&amp;rsquo;t see any statistics returned, try running the command again after a few minutes.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;To start lets print the query performance of our logs:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;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 stats --since 24h &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will provide a JSON object containing statistics on the amount of data queried. The output will look similar to the following:&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;console&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-console&#34;&gt;http://localhost:3100/loki/api/v1/index/stats?end=1732639430272850000&amp;amp;query=%7Bservice_name%3D%22Delivery&amp;#43;World%22%7D&amp;amp;start=1732553030272850000
{
  bytes: 12MB
  chunks: 63
  streams: 15
  entries: 29529
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will return the total number of bytes queried, the number of chunks queried, the number of streams queried, and the number of entries queried. If we narrow down the query by specifying a secondary label, we can see the performance of the 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;logcli stats --since 24h &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;, package_size=&amp;#34;Large&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will return the statistics for the logs where the &lt;code&gt;service_name&lt;/code&gt; is &lt;code&gt;Delivery World&lt;/code&gt; and the &lt;code&gt;package_size&lt;/code&gt; is &lt;code&gt;Large&lt;/code&gt;. The output will look similar to the following:&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;console&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-console&#34;&gt;{
  bytes: 4.2MB
  chunks: 22
  streams: 5
  entries: 10198
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;As you can see, we touched far fewer streams and entries by narrowing down the query.&lt;/p&gt;
&lt;h3 id=&#34;checking-the-log-volume&#34;&gt;Checking the log volume&lt;/h3&gt;
&lt;p&gt;We may also want to check the log volume in our logs. This can be useful for understanding the amount of data being ingested into Loki. We can use LogCLI to check the log volume in our logs.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;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 volume --since 24h &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This returns the total number of logs ingested for the label &lt;code&gt;Delivery World&lt;/code&gt; in the last 24 hours. The output will look similar to the following:&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;console&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-console&#34;&gt;[
  {
    &amp;#34;metric&amp;#34;: {
      &amp;#34;service_name&amp;#34;: &amp;#34;Delivery World&amp;#34;
    },
    &amp;#34;value&amp;#34;: [
      1732640292.354,
      &amp;#34;11669299&amp;#34;
    ]
  }
]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The result includes the timestamp and the total number of logs ingested.&lt;/p&gt;
&lt;p&gt;We can also return the log volume over time by using &lt;code&gt;volume_range&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;logcli volume_range --since 24h --step=1h &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will provide a JSON object containing the log volume for the label &lt;code&gt;Delivery World&lt;/code&gt; in the last 24 hours. &lt;code&gt;--step&lt;/code&gt; will aggregate the log volume into 1 hour buckets. Note that if there are no logs for a specific hour, the log volume for that hour will not return a value.&lt;/p&gt;
&lt;p&gt;We can even aggregate the log volume into buckets based on a specific labels value:&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;logcli volume_range --since 24h --step=1h --targetLabels=&amp;#39;state&amp;#39; &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;}&amp;#39; &lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will provide a similar JSON object but will aggregate the log volume into buckets based on the &lt;code&gt;state&lt;/code&gt; label value.&lt;/p&gt;
&lt;!-- INTERACTIVE page step3.md END --&gt;
&lt;!-- INTERACTIVE page step4.md START --&gt;
&lt;h2 id=&#34;queries-against-static-log-files&#34;&gt;Queries against static log files&lt;/h2&gt;
&lt;p&gt;In addition to querying logs from Loki, LogCLI also supports querying static log files. This can be useful for querying logs that are not stored in Loki. Earlier in the tutorial we stored the logs in the &lt;code&gt;./inventory&lt;/code&gt; directory. Lets run a similar query but pipe it into a log 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;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 query \
     --timezone=UTC \
     --parallel-duration=&amp;#34;12h&amp;#34; \
     --parallel-max-workers=&amp;#34;4&amp;#34; \
     --part-path-prefix=&amp;#34;./inventory/inv&amp;#34; \
     --since=24h \
     --merge-parts \
     --output=raw \
     &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;}&amp;#39; &amp;gt; ./inventory/complete.log&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Next lets run a query against the static log 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;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;cat ./inventory/complete.log |  logcli --stdin query &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;} | json | package_status=&amp;#34;critical&amp;#34;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note that since we are querying a static log file, labels are not automatically detected:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;{service_name=&amp;quot;Delivery World&amp;quot;}&lt;/code&gt; is optional in this case but is recommended for clarity.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;json&lt;/code&gt; is required to parse the log file as JSON. This lets us extract the &lt;code&gt;package_status&lt;/code&gt; field.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example, suppose we try to query the log file without the &lt;code&gt;json&lt;/code&gt; filter:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;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;cat ./inventory/complete.log | logcli --stdin query &amp;#39;{service_name=&amp;#34;Delivery World&amp;#34;} | package_status=&amp;#34;critical&amp;#34;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will return no results as the &lt;code&gt;package_status&lt;/code&gt; field is not detected.&lt;/p&gt;
&lt;!-- INTERACTIVE page step4.md END --&gt;
&lt;!-- INTERACTIVE page finish.md START --&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;In this tutorial as site manager for a logistics company, we have successfully used LogCLI to query logs and build a report on the overall health of the shipments. We have also used meta queries to better understand our data cleanliness and query performance. The LogCLI is a powerful tool for understanding your logs and how they are stored in Loki, as you continue to scale your solution remember to keep LogCLI in mind to monitor cardinality and query performance.&lt;/p&gt;
&lt;!-- INTERACTIVE page finish.md END --&gt;
]]></content><description>&lt;!-- INTERACTIVE page intro.md START -->
&lt;h1 id="logcli-tutorial">LogCLI tutorial&lt;/h1>
&lt;p>This
&lt;a href="/docs/loki/v3.7.x/query/logcli/">LogCLI&lt;/a> tutorial will walk you through the following concepts:&lt;/p>
&lt;ul>
&lt;li>Querying logs&lt;/li>
&lt;li>Meta Queries against your Loki instance&lt;/li>
&lt;li>Queries against static log files&lt;/li>
&lt;/ul>
&lt;!-- INTERACTIVE ignore START -->
&lt;h2 id="prerequisites">Prerequisites&lt;/h2>
&lt;p>Before you begin, you need to have the following:&lt;/p></description></item></channel></rss>