<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Grafana Loki configuration parameters on Grafana Labs</title><link>https://grafana.com/docs/loki/v3.7.x/configure/</link><description>Recent content in Grafana Loki configuration parameters on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/loki/v3.7.x/configure/index.xml" rel="self" type="application/rss+xml"/><item><title>Configuration best practices</title><link>https://grafana.com/docs/loki/v3.7.x/configure/bp-configure/</link><pubDate>Thu, 09 Apr 2026 02:28:18 +0000</pubDate><guid>https://grafana.com/docs/loki/v3.7.x/configure/bp-configure/</guid><content><![CDATA[&lt;h1 id=&#34;configuration-best-practices&#34;&gt;Configuration best practices&lt;/h1&gt;
&lt;p&gt;Grafana Loki is under active development, and the Loki team is constantly working to improve performance. But here are some of the most current best practices for configuration that will give you the best experience with Loki.&lt;/p&gt;
&lt;h2 id=&#34;configure-authentication&#34;&gt;Configure authentication&lt;/h2&gt;
&lt;p&gt;Grafana Loki does not come with any included authentication layer. You must run an authenticating reverse proxy in front of your services to prevent unauthorized access to Loki (for example, nginx). Refer to 
    &lt;a href=&#34;/docs/loki/v3.7.x/operations/authentication/&#34;&gt;Manage authentication&lt;/a&gt; for a list of open-source reverse proxies you can use.&lt;/p&gt;
&lt;h2 id=&#34;configure-caching&#34;&gt;Configure caching&lt;/h2&gt;
&lt;p&gt;Loki can cache data at many levels, which can drastically improve performance. Details of this will be in a future post.&lt;/p&gt;
&lt;h2 id=&#34;time-ordering-of-logs&#34;&gt;Time ordering of logs&lt;/h2&gt;
&lt;p&gt;Loki 
    &lt;a href=&#34;/docs/loki/v3.7.x/configure/#accept-out-of-order-writes&#34;&gt;accepts out-of-order writes&lt;/a&gt; &lt;em&gt;by default&lt;/em&gt;.
This section identifies best practices when Loki is &lt;em&gt;not&lt;/em&gt; configured to accept out-of-order writes.&lt;/p&gt;
&lt;p&gt;One issue many people have with Loki is their client receiving errors for out of order log entries. This happens because of this hard and fast rule within Loki:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For any single log stream, logs must always be sent in increasing time order. If a log is received with a timestamp older than the most recent log received for that stream, that log will be dropped.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are a few things to dissect from that statement. The first is this restriction is per stream. Let’s look at an example:&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;{job=&amp;#34;syslog&amp;#34;} 00:00:00 i&amp;#39;m a syslog!
{job=&amp;#34;syslog&amp;#34;} 00:00:01 i&amp;#39;m a syslog!&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If Loki received these two lines which are for the same stream, everything would be fine. But what about this case:&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;{job=&amp;#34;syslog&amp;#34;} 00:00:00 i&amp;#39;m a syslog!
{job=&amp;#34;syslog&amp;#34;} 00:00:02 i&amp;#39;m a syslog!
{job=&amp;#34;syslog&amp;#34;} 00:00:01 i&amp;#39;m a syslog!  &amp;lt;- Rejected out of order!&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;What can you do about this? What if this was because the sources of these logs were different systems? You can solve this with an additional label which is unique per system:&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;{job=&amp;#34;syslog&amp;#34;, instance=&amp;#34;host1&amp;#34;} 00:00:00 i&amp;#39;m a syslog!
{job=&amp;#34;syslog&amp;#34;, instance=&amp;#34;host1&amp;#34;} 00:00:02 i&amp;#39;m a syslog!
{job=&amp;#34;syslog&amp;#34;, instance=&amp;#34;host2&amp;#34;} 00:00:01 i&amp;#39;m a syslog!  &amp;lt;- Accepted, this is a new stream!
{job=&amp;#34;syslog&amp;#34;, instance=&amp;#34;host1&amp;#34;} 00:00:03 i&amp;#39;m a syslog!  &amp;lt;- Accepted, still in order for stream 1
{job=&amp;#34;syslog&amp;#34;, instance=&amp;#34;host2&amp;#34;} 00:00:02 i&amp;#39;m a syslog!  &amp;lt;- Accepted, still in order for stream 2&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;But what if the application itself generated logs that were out of order? Well, I&amp;rsquo;m afraid this is a problem. If you are extracting the timestamp from the log line with something like the &lt;a href=&#34;/docs/alloy/latest/reference/components/loki/loki.process/#stagetimestamp&#34;&gt;Alloy &lt;code&gt;stage.timestamp&lt;/code&gt; block&lt;/a&gt;, you could instead &lt;em&gt;not&lt;/em&gt; do this and let your log shipping agent assign a timestamp to the log lines. Or you can hopefully fix it in the application itself.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also worth noting that the batching nature of the Loki push API can lead to some instances of out of order errors being received which are really false positives. (Perhaps a batch partially succeeded and was present; or anything that previously succeeded would return an out of order entry; or anything new would be accepted.)&lt;/p&gt;
&lt;h2 id=&#34;use-snappy-compression-algorithm&#34;&gt;Use &lt;code&gt;snappy&lt;/code&gt; compression algorithm&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;Snappy&lt;/code&gt; is currently the Loki compression algorithm of choice. It performs much better than &lt;code&gt;gzip&lt;/code&gt; for speed, but it is not as efficient in storage. This was an acceptable tradeoff for us.&lt;/p&gt;
&lt;p&gt;Grafana Labs has found that &lt;code&gt;gzip&lt;/code&gt; was very good for compression but was very slow, and this was causing slow query responses.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;LZ4&lt;/code&gt; is a good compromise of speed and compression performance. While compression is slightly slower than &lt;code&gt;snappy&lt;/code&gt;, the compression ratio is higher, resulting in smaller chunks in object storage.&lt;/p&gt;
&lt;h2 id=&#34;use-chunk_target_size&#34;&gt;Use &lt;code&gt;chunk_target_size&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Using &lt;code&gt;chunk_target_size&lt;/code&gt; instructs Loki to try to fill all chunks to a target &lt;em&gt;compressed&lt;/em&gt; size of 1.5MB. These larger chunks are more efficient for Loki to process.&lt;/p&gt;
&lt;p&gt;Other configuration variables affect how full a chunk can get. Loki has a default &lt;code&gt;max_chunk_age&lt;/code&gt; of 2h and &lt;code&gt;chunk_idle_period&lt;/code&gt; of 30m to limit the amount of memory used as well as the exposure of lost logs if the process crashes.&lt;/p&gt;
&lt;p&gt;Depending on the compression used (Loki has been using snappy which has less compressibility but faster performance), you need 5-10x or 7.5-10MB of raw log data to fill a 1.5MB chunk. Remembering that a chunk is per stream, the more streams you break up your log files into, the more chunks that sit in memory, and the higher likelihood they get flushed by hitting one of those timeouts mentioned above before they are filled.&lt;/p&gt;
&lt;p&gt;Lots of small, unfilled chunks negatively affect Loki. The team is always working to improve this and may consider a compactor to improve this in some situations. But, in general, the guidance should stay about the same: try your best to fill chunks.&lt;/p&gt;
&lt;p&gt;If you have an application that can log fast enough to fill these chunks quickly (much less than &lt;code&gt;max_chunk_age&lt;/code&gt;), then it becomes more reasonable to use dynamic labels to break that up into separate streams.&lt;/p&gt;
&lt;h2 id=&#34;use--print-config-stderr-or--log-config-reverse-order&#34;&gt;Use &lt;code&gt;-print-config-stderr&lt;/code&gt; or &lt;code&gt;-log-config-reverse-order&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Loki has flags which will dump the entire config object to stderr or the log file when it starts.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;-print-config-stderr&lt;/code&gt; works well when invoking Loki from the command line, as you can get a quick output of the entire Loki configuration.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;-log-config-reverse-order&lt;/code&gt; is the flag Grafana runs Loki with in all our environments. The configuration entries are reversed, so that the order of the configuration reads correctly top to bottom when viewed in Grafana&amp;rsquo;s Explore.&lt;/p&gt;
&lt;h2 id=&#34;recommended-production-limits&#34;&gt;Recommended production limits&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;limits_config:
  # Rate limits
  ingestion_rate_strategy: global
  ingestion_rate_mb: 10
  ingestion_burst_size_mb: 20
  per_stream_rate_limit: 3MB
  per_stream_rate_limit_burst: 15MB
  
  # Stream limits
  max_global_streams_per_user: 10000
  max_streams_per_user: 0
  
  # Validation
  max_line_size: 256KB
  max_line_size_truncate: false
  max_label_name_length: 1024
  max_label_value_length: 2048
  max_label_names_per_series: 15
  
  # Time constraints
  reject_old_samples: true
  reject_old_samples_max_age: 168h  # 7 days
  creation_grace_period: 10m
  unordered_writes: true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;recommended-ingester-configuration&#34;&gt;Recommended Ingester configuration&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;ingester:
  # Chunk settings
  chunk_idle_period: 30m
  chunk_target_size: 1572864  # 1.5 MB
  chunk_encoding: snappy
  max_chunk_age: 2h
  
  # WAL settings
  wal:
    enabled: true
    dir: /loki/wal
    checkpoint_duration: 5m
    flush_on_shutdown: true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="configuration-best-practices">Configuration best practices&lt;/h1>
&lt;p>Grafana Loki is under active development, and the Loki team is constantly working to improve performance. But here are some of the most current best practices for configuration that will give you the best experience with Loki.&lt;/p></description></item><item><title>Storage</title><link>https://grafana.com/docs/loki/v3.7.x/configure/storage/</link><pubDate>Thu, 09 Apr 2026 02:28:18 +0000</pubDate><guid>https://grafana.com/docs/loki/v3.7.x/configure/storage/</guid><content><![CDATA[&lt;h1 id=&#34;storage&#34;&gt;Storage&lt;/h1&gt;
&lt;p&gt;Unlike other logging systems, Grafana Loki is built around the idea of only indexing
metadata about your logs: labels (just like Prometheus labels). Log data itself
is then compressed and stored in chunks in object stores such as S3 or GCS, or
even locally on the filesystem. A small index and highly compressed chunks
simplifies the operation and significantly lowers the cost of Loki.&lt;/p&gt;
&lt;p&gt;Loki 2.8 introduced TSDB as a new mode for the Single Store and is now the recommended way to persist data in Loki.
More detailed information about TSDB can be found under the 
    &lt;a href=&#34;/docs/loki/v3.7.x/operations/storage/tsdb/&#34;&gt;manage section&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Loki 2.0 introduced an index mechanism named &amp;lsquo;boltdb-shipper&amp;rsquo; and is what we now call &lt;a href=&#34;#single-store&#34;&gt;Single Store&lt;/a&gt;.
This type only requires one store, the object store, for both the index and chunks.
More detailed information about &amp;lsquo;boltdb-shipper&amp;rsquo; can be found under the 
    &lt;a href=&#34;/docs/loki/v3.7.x/operations/storage/boltdb-shipper/&#34;&gt;manage section&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Prior to Loki 2.0, chunks and index data were stored in separate backends:
object storage (or filesystem) for chunk data and NoSQL/Key-Value databases for index data. These &amp;ldquo;multistore&amp;rdquo; backends have been deprecated, as noted below.&lt;/p&gt;
&lt;p&gt;You can find more detailed information about all of the storage options in the 
    &lt;a href=&#34;/docs/loki/v3.7.x/operations/storage/&#34;&gt;manage section&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;single-store&#34;&gt;Single Store&lt;/h2&gt;
&lt;p&gt;Single Store refers to using object storage as the storage medium for both the Loki index as well as its data (&amp;ldquo;chunks&amp;rdquo;). There are two supported modes:&lt;/p&gt;
&lt;h3 id=&#34;tsdb-recommended&#34;&gt;TSDB (recommended)&lt;/h3&gt;
&lt;p&gt;Starting in Loki 2.8, the 
    &lt;a href=&#34;/docs/loki/v3.7.x/operations/storage/tsdb/&#34;&gt;TSDB index store&lt;/a&gt; improves query performance, reduces TCO and has the same feature parity as &amp;ldquo;boltdb-shipper&amp;rdquo;. TSDB is the recommended index store for Loki 2.8 and newer.&lt;/p&gt;
&lt;h3 id=&#34;boltdb-deprecated&#34;&gt;BoltDB (deprecated)&lt;/h3&gt;
&lt;p&gt;Also known as &amp;ldquo;boltdb-shipper&amp;rdquo; during development (and is still the schema &lt;code&gt;store&lt;/code&gt; name). The single store configurations for Loki utilize the chunk store for both chunks and the index, requiring just one store to run Loki. BoldDB is the recommended index store for Loki v2.0.0 through v2.7x.&lt;/p&gt;
&lt;p&gt;Performance is comparable to a dedicated index type while providing a much less expensive and less complicated deployment.
When using Single Store, no extra &lt;a href=&#34;#chunk-storage&#34;&gt;Chunk storage&lt;/a&gt; and &lt;a href=&#34;#index-storage&#34;&gt;Index storage&lt;/a&gt; are necessary.&lt;/p&gt;
&lt;h3 id=&#34;supported-storage-backends&#34;&gt;Supported storage backends&lt;/h3&gt;
&lt;p&gt;See &lt;a href=&#34;#object-storage&#34;&gt;Object Storage&lt;/a&gt; for supported backends.&lt;/p&gt;
&lt;h2 id=&#34;chunk-storage&#34;&gt;Chunk storage&lt;/h2&gt;
&lt;h3 id=&#34;file-system&#34;&gt;File system&lt;/h3&gt;
&lt;p&gt;The file system is the simplest backend for chunks, although it&amp;rsquo;s also susceptible to data loss as it&amp;rsquo;s unreplicated. This is common for single binary deployments though, as well as for those trying out loki or doing local development on the project. It is similar in concept to many Prometheus deployments where a single Prometheus is responsible for monitoring a fleet.&lt;/p&gt;
&lt;h3 id=&#34;object-storage&#34;&gt;Object storage&lt;/h3&gt;
&lt;h4 id=&#34;google-cloud-storage-gcs&#34;&gt;Google Cloud Storage (GCS)&lt;/h4&gt;
&lt;p&gt;GCS is a hosted object store offered by Google. It is a good candidate for a managed object store, especially when you&amp;rsquo;re already running on GCP, and is production safe.&lt;/p&gt;
&lt;h4 id=&#34;amazon-simple-storage-storage-s3&#34;&gt;Amazon Simple Storage Storage (S3)&lt;/h4&gt;
&lt;p&gt;S3 is AWS&amp;rsquo;s hosted object store. It is a good candidate for a managed object store, especially when you&amp;rsquo;re already running on AWS, and is production safe.&lt;/p&gt;
&lt;h4 id=&#34;azure-blob-storage&#34;&gt;Azure Blob Storage&lt;/h4&gt;
&lt;p&gt;Blob Storage is Microsoft Azure&amp;rsquo;s hosted object store. It is a good candidate for a managed object store, especially when you&amp;rsquo;re already running on Azure, and is production safe.
You can authenticate Blob Storage access by using a storage account name and key or by using a Service Principal.&lt;/p&gt;
&lt;h4 id=&#34;ibm-cloud-object-storage-cos&#34;&gt;IBM Cloud Object Storage (COS)&lt;/h4&gt;
&lt;p&gt;&lt;a href=&#34;https://www.ibm.com/cloud/object-storage&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;COS&lt;/a&gt; is IBM Cloud hosted object store. It is a good candidate for a managed object store, especially when you&amp;rsquo;re already running on IBM Cloud, and is production safe.&lt;/p&gt;
&lt;h4 id=&#34;baidu-object-storage-bos&#34;&gt;Baidu Object Storage (BOS)&lt;/h4&gt;
&lt;p&gt;&lt;a href=&#34;https://intl.cloud.baidu.com/product/bos.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;BOS&lt;/a&gt; is the Baidu Cloud hosted object storage.&lt;/p&gt;
&lt;h4 id=&#34;alibaba-object-storage-service-oss&#34;&gt;Alibaba Object Storage Service (OSS)&lt;/h4&gt;
&lt;p&gt;&lt;a href=&#34;https://www.alibabacloud.com/product/object-storage-service&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OSS&lt;/a&gt; is the Alibaba Cloud hosted object storage.&lt;/p&gt;
&lt;h4 id=&#34;other-notable-mentions&#34;&gt;Other notable mentions&lt;/h4&gt;
&lt;p&gt;You may use any substitutable services, such as those that implement the S3 API like &lt;a href=&#34;https://min.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;MinIO&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;cassandra-deprecated&#34;&gt;Cassandra (deprecated)&lt;/h3&gt;
&lt;p&gt;Cassandra is a popular database and one of the possible chunk stores for Loki and is production safe.&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;This storage type for chunks is deprecated and may be removed in future major versions of Loki.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;index-storage&#34;&gt;Index storage&lt;/h2&gt;
&lt;h3 id=&#34;cassandra-deprecated-1&#34;&gt;Cassandra (deprecated)&lt;/h3&gt;
&lt;p&gt;Cassandra can also be utilized for the index store and aside from the 
    &lt;a href=&#34;/docs/loki/v3.7.x/operations/storage/boltdb-shipper/&#34;&gt;boltdb-shipper&lt;/a&gt;, it&amp;rsquo;s the only non-cloud offering that can be used for the index that&amp;rsquo;s horizontally scalable and has configurable replication. It&amp;rsquo;s a good candidate when you already run Cassandra, are running on-prem, or do not wish to use a managed cloud offering.&lt;/p&gt;


&lt;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;This storage type for indexes is deprecated and may be removed in future major versions of Loki.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;bigtable-deprecated&#34;&gt;BigTable (deprecated)&lt;/h3&gt;
&lt;p&gt;Bigtable is a cloud database offered by Google. It is a good candidate for a managed index store if you&amp;rsquo;re already using it (due to its heavy fixed costs) or wish to run in GCP.&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;This storage type for indexes is deprecated and may be removed in future major versions of Loki.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;dynamodb-deprecated&#34;&gt;DynamoDB (deprecated)&lt;/h3&gt;
&lt;p&gt;DynamoDB is a cloud database offered by AWS. It is a good candidate for a managed index store, especially if you&amp;rsquo;re already running in AWS.&lt;/p&gt;


&lt;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;This storage type for indexes is deprecated and may be removed in future major versions of Loki.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h4 id=&#34;rate-limiting&#34;&gt;Rate limiting&lt;/h4&gt;
&lt;p&gt;DynamoDB is susceptible to rate limiting, particularly due to overconsuming what is called &lt;a href=&#34;https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;provisioned capacity&lt;/a&gt;. This can be controlled via the &lt;a href=&#34;#provisioning&#34;&gt;provisioning&lt;/a&gt; configs in the table manager.&lt;/p&gt;
&lt;h3 id=&#34;boltdb-deprecated-1&#34;&gt;BoltDB (deprecated)&lt;/h3&gt;
&lt;p&gt;BoltDB is an embedded database on disk. It is not replicated and thus cannot be used for high availability or clustered Loki deployments, but is commonly paired with a &lt;code&gt;filesystem&lt;/code&gt; chunk store for proof of concept deployments, trying out Loki, and development. The 
    &lt;a href=&#34;/docs/loki/v3.7.x/operations/storage/boltdb-shipper/&#34;&gt;boltdb-shipper&lt;/a&gt; aims to support clustered deployments using &lt;code&gt;boltdb&lt;/code&gt; as an index.&lt;/p&gt;


&lt;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;This storage type for indexes is deprecated and may be removed in future major versions of Loki.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;schema-config&#34;&gt;Schema Config&lt;/h2&gt;
&lt;p&gt;Loki aims to be backwards compatible and over the course of its development has had many internal changes that facilitate better and more efficient storage/querying. Loki allows incrementally upgrading to these new storage &lt;em&gt;schemas&lt;/em&gt; and can query across them transparently. This makes upgrading a breeze.
For instance, this is what it looks like when migrating from BoltDB with v11 schema to TSDB with v13 schema starting 2023-07-01:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;schema_config:
  configs:
    - from: 2019-07-01
      store: boltdb
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 24h
    - from: 2023-07-01
      store: tsdb
      object_store: filesystem
      schema: v13
      index:
        prefix: index_
        period: 24h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For all data ingested before 2023-07-01, Loki used BoltDB with the v11 schema, and then switched after that point to the more effective TSDB with the v13 schema. This dramatically simplifies upgrading, ensuring it&amp;rsquo;s simple to take advantage of new storage optimizations. These configs should be immutable for as long as you care about retention.&lt;/p&gt;
&lt;h2 id=&#34;table-manager-deprecated&#34;&gt;Table Manager (deprecated)&lt;/h2&gt;
&lt;p&gt;One of the subcomponents in Loki is the &lt;code&gt;table-manager&lt;/code&gt;. It is responsible for pre-creating and expiring index tables. This helps partition the writes and reads in Loki across a set of distinct indices in order to prevent unbounded growth.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;table_manager:
  # The retention period must be a multiple of the index / chunks
  # table &amp;#34;period&amp;#34; (see period_config).
  retention_deletes_enabled: true
  # This is 15 weeks retention, based on the 168h (1week) period durations used in the rest of the examples.
  retention_period: 2520h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information, see the 
    &lt;a href=&#34;/docs/loki/v3.7.x/operations/storage/tsdb/&#34;&gt;table manager&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h3 id=&#34;provisioning&#34;&gt;Provisioning&lt;/h3&gt;
&lt;p&gt;In the case of AWS DynamoDB, you&amp;rsquo;ll likely want to tune the provisioned throughput for your tables as well. This is to prevent your tables being rate limited on one hand and assuming unnecessary cost on the other. By default Loki uses a &lt;a href=&#34;https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;provisioned capacity&lt;/a&gt; strategy for DynamoDB tables like so:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;table_manager:
  index_tables_provisioning:
    # Read/write throughput requirements for the current table
    # (the table which would handle writes/reads for data timestamped at the current time)
    provisioned_write_throughput: &amp;lt;int&amp;gt; | default = 3000
    provisioned_read_throughput: &amp;lt;int&amp;gt; | default = 300

    # Read/write throughput requirements for non-current tables
    inactive_write_throughput: &amp;lt;int&amp;gt; | default = 1
    inactive_read_throughput: &amp;lt;int&amp;gt; | Default = 300&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note, there are a few other DynamoDB provisioning options including DynamoDB autoscaling and on-demand capacity. See the 
    &lt;a href=&#34;/docs/loki/v3.7.x/configure/#table_manager&#34;&gt;provisioning configuration&lt;/a&gt; in the &lt;code&gt;table_manager&lt;/code&gt; block documentation for more information.&lt;/p&gt;
&lt;h2 id=&#34;upgrading-schemas&#34;&gt;Upgrading Schemas&lt;/h2&gt;
&lt;p&gt;When a new schema is released and you want to gain the advantages it provides, you can! Loki can transparently query and merge data from across schema boundaries so there is no disruption of service and upgrading is easy.&lt;/p&gt;
&lt;p&gt;First, you&amp;rsquo;ll want to create a new 
    &lt;a href=&#34;/docs/loki/v3.7.x/configure/#period_config&#34;&gt;period_config&lt;/a&gt; entry in your 
    &lt;a href=&#34;/docs/loki/v3.7.x/configure/#schema_config&#34;&gt;schema_config&lt;/a&gt;. The important thing to remember here is to set this at some point in the &lt;em&gt;future&lt;/em&gt; and then roll out the config file changes to Loki. This allows the table manager to create the required table in advance of writes and ensures that existing data isn&amp;rsquo;t queried as if it adheres to the new schema.&lt;/p&gt;
&lt;p&gt;As an example, let&amp;rsquo;s say it&amp;rsquo;s 2023-07-14 and you want to start using the &lt;code&gt;v13&lt;/code&gt; schema on the 20th:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;schema_config:
  configs:
    - from: 2019-07-14
      store: tsdb
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 24h
    - from: 2023-07-20
      store: tsdb
      object_store: filesystem
      schema: v13
      index:
        prefix: index_
        period: 24h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;It&amp;rsquo;s that easy; you just created a new entry starting on the 20th.&lt;/p&gt;
&lt;h2 id=&#34;retention&#34;&gt;Retention&lt;/h2&gt;
&lt;p&gt;Loki manages retention through the Compactor when using TSDB or the BoltDB Shipper. When retention is enabled, the Compactor identifies data that falls outside of the configured retention period, removes the corresponding index entries, and deletes the underlying chunk objects asynchronously.&lt;/p&gt;
&lt;p&gt;For object storage backends (S3, GCS, Azure Blob) Loki no longer relies solely on external time to live (TTL) or bucket lifecycle rules; these may still be used as an additional safeguard, but Loki itself performs retention-driven deletion when configured.&lt;/p&gt;
&lt;p&gt;When using the filesystem chunk store, Loki does not delete data based on disk usage or free-space conditions. Deletion is determined only by the retention settings, and disk-full scenarios must be handled operationally outside of Loki.&lt;/p&gt;
&lt;p&gt;Loki also supports targeted deletion at the tenant or stream level.&lt;/p&gt;
&lt;p&gt;For more information, see the 
    &lt;a href=&#34;/docs/loki/v3.7.x/operations/storage/retention/&#34;&gt;retention configuration&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;h3 id=&#34;single-machinelocal-development-tsdbfilesystem&#34;&gt;Single machine/local development (tsdb&#43;filesystem)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/grafana/loki/blob/main/cmd/loki/loki-local-config.yaml&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;The repo contains a working example&lt;/a&gt;, you may want to checkout a tag of the repo to make sure you get a compatible example.&lt;/p&gt;
&lt;h3 id=&#34;gcp-deployment-gcs-single-store&#34;&gt;GCP deployment (GCS Single Store)&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;storage_config:
  tsdb_shipper:
    active_index_directory: /loki/index
    cache_location: /loki/index_cache
    cache_ttl: 24h # Can be increased for faster performance over longer query periods, uses more disk space
  gcs:
    bucket_name: &amp;lt;bucket&amp;gt;
    service_account: |
      {
        &amp;#34;type&amp;#34;: &amp;#34;service_account&amp;#34;,
        ...
      }

schema_config:
  configs:
    - from: 2020-07-01
      store: tsdb
      object_store: gcs
      schema: v13
      index:
        prefix: index_
        period: 24h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;service_account&lt;/code&gt; should contain JSON from either a GCP Console &lt;code&gt;client_credentials.json&lt;/code&gt; file or a GCP service account key. If this value is blank, most services will fall back to GCP&amp;rsquo;s Application Default Credentials (ADC) strategy. For more information about ADC, refer to &lt;a href=&#34;https://cloud.google.com/docs/authentication/application-default-credentials&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;How Application Default Credentials works&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&#34;https://cloud.google.com/storage/docs/access-control/iam-roles&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;pre-defined &lt;code&gt;storage.objectUser&lt;/code&gt; role&lt;/a&gt; (or a custom role modeled after it) contains sufficient permissions for Loki to operate.&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;GCP recommends &lt;a href=&#34;https://cloud.google.com/iam/docs/workload-identity-federation&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Workload Identity Federation&lt;/a&gt; instead of a service account key.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;aws-deployment-s3-single-store&#34;&gt;AWS deployment (S3 Single Store)&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;storage_config:
  tsdb_shipper:
    active_index_directory: /loki/index
    cache_location: /loki/index_cache
    cache_ttl: 24h         # Can be increased for faster performance over longer query periods, uses more disk space
  aws:
    s3: s3://&amp;lt;access_key&amp;gt;:&amp;lt;uri-encoded-secret-access-key&amp;gt;@&amp;lt;region&amp;gt;
    bucketnames: &amp;lt;bucket1,bucket2&amp;gt;

schema_config:
  configs:
    - from: 2020-07-01
      store: tsdb
      object_store: s3
      schema: v13
      index:
        prefix: index_
        period: 24h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you don&amp;rsquo;t wish to hard-code S3 credentials, you can also configure an EC2
instance role by changing the &lt;code&gt;storage_config&lt;/code&gt; section:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;storage_config:
  aws:
    s3: s3://region
    bucketnames: &amp;lt;bucket1,bucket2&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The role should have a policy with the following permissions attached.&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;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
    &amp;#34;Statement&amp;#34;: [
        {
            &amp;#34;Sid&amp;#34;: &amp;#34;LokiStorage&amp;#34;,
            &amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
            &amp;#34;Principal&amp;#34;: {
                &amp;#34;AWS&amp;#34;: [
                    &amp;#34;arn:aws:iam::&amp;lt;account_ID&amp;gt;&amp;#34;
                ]
            },
            &amp;#34;Action&amp;#34;: [
                &amp;#34;s3:ListBucket&amp;#34;,
                &amp;#34;s3:PutObject&amp;#34;,
                &amp;#34;s3:GetObject&amp;#34;,
                &amp;#34;s3:DeleteObject&amp;#34;
            ],
            &amp;#34;Resource&amp;#34;: [
                &amp;#34;arn:aws:s3:::&amp;lt;bucket_name&amp;gt;&amp;#34;,
                &amp;#34;arn:aws:s3:::&amp;lt;bucket_name&amp;gt;/*&amp;#34;
            ]
        }
    ]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;To setup an S3 bucket and an IAM role and policy:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This guide assumes a provisioned EKS cluster.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Checkout the Loki repository and navigate to &lt;a href=&#34;https://github.com/grafana/loki/tree/main/production/terraform/modules/s3&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;production/terraform/modules/s3&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Initialize Terraform &lt;code&gt;terraform init&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Export the AWS profile and region if not done so:&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 AWS_PROFILE=&amp;lt;profile in ~/.aws/config&amp;gt;
export AWS_REGION=&amp;lt;region of EKS cluster&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Save the OIDC provider in an environment variable:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;oidc_provider=$(aws eks describe-cluster --name &amp;lt;EKS cluster&amp;gt; --query &amp;#34;cluster.identity.oidc.issuer&amp;#34; --output text | sed -e &amp;#34;s/^https:\/\///&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;See the &lt;a href=&#34;https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;IAM OIDC provider guide&lt;/a&gt; for a guide for creating a provider.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Apply the Terraform module &lt;code&gt;terraform -var region=&amp;quot;$AWS_REGION&amp;quot; -var cluster_name=&amp;lt;EKS cluster&amp;gt; -var oidc_id=&amp;quot;$oidc_provider&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Note, the bucket name defaults to &lt;code&gt;loki-data&lt;/code&gt; but can be changed via the
&lt;code&gt;bucket_name&lt;/code&gt; variable.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;azure-deployment-azure-blob-storage-single-store&#34;&gt;Azure deployment (Azure Blob Storage Single Store)&lt;/h3&gt;
&lt;h4 id=&#34;using-account-name-and-key&#34;&gt;Using account name and key&lt;/h4&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;schema_config:
  configs:
    - from: &amp;#34;2020-12-11&amp;#34;
      index:
        period: 24h
        prefix: index_
      object_store: azure
      schema: v13
      store: tsdb
storage_config:
  azure:
    # Your Azure storage account name
    account_name: &amp;lt;account-name&amp;gt;
    # For the account-key, see docs: https://docs.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage?tabs=azure-portal
    account_key: &amp;lt;account-key&amp;gt;
    # See https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction#containers
    container_name: &amp;lt;container-name&amp;gt;
    use_managed_identity: &amp;lt;true|false&amp;gt;
    # Providing a user assigned ID will override use_managed_identity
    user_assigned_id: &amp;lt;user-assigned-identity-id&amp;gt;
    request_timeout: 0
    # Configure this if you are using private azure cloud like azure stack hub and will use this endpoint suffix to compose container and blob storage URL. Ex: https://account_name.endpoint_suffix/container_name/blob_name
    endpoint_suffix: &amp;lt;endpoint-suffix&amp;gt;
    # If `connection_string` is set, the values of `account_name` and `endpoint_suffix` values will not be used. Use this method over `account_key` if you need to authenticate via a SAS token. Or if you use the Azurite emulator.
    connection_string: &amp;lt;connection-string&amp;gt;
  tsdb_shipper:
    active_index_directory: /loki/index
    cache_location: /loki/index_cache
    cache_ttl: 24h
  filesystem:
    directory: /loki/chunks&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h4 id=&#34;using-a-service-principal&#34;&gt;Using a service principal&lt;/h4&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;schema_config:
  configs:
    - from: &amp;#34;2020-12-11&amp;#34;
      index:
        period: 24h
        prefix: index_
      object_store: azure
      schema: v13
      store: tsdb
storage_config:
  azure:
    use_service_principal: true
    # Azure tenant ID used to authenticate through Azure OAuth
    tenant_id : &amp;lt;tenant-id&amp;gt;
    # Azure Service Principal ID
    client_id: &amp;lt;client-id&amp;gt;
    # Azure Service Principal secret key
    client_secret: &amp;lt;client-secret&amp;gt;
    # See https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction#containers
    container_name: &amp;lt;container-name&amp;gt;
    request_timeout: 0
  tsdb_shipper:
    active_index_directory: /loki/index
    cache_location: /loki/index_cache
    cache_ttl: 24h
  filesystem:
    directory: /loki/chunks&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;ibm-deployment-cos-single-store&#34;&gt;IBM Deployment (COS Single Store)&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;schema_config:
  configs:
    - from: 2020-10-01
      index:
        period: 24h
        prefix: loki_index_
      object_store: cos
      schema: v13
      store: tsdb

storage_config:
  tsdb_shipper:
    active_index_directory: /loki/index
    cache_location: /loki/index_cache
  cos:
    bucketnames: &amp;lt;bucket1, bucket2&amp;gt;
    endpoint: &amp;lt;endpoint&amp;gt;
    api_key: &amp;lt;api_key_to_authenticate_with_cos&amp;gt;
    region: &amp;lt;region&amp;gt;
    service_instance_id: &amp;lt;cos_service_instance_id&amp;gt;
    auth_endpoint: &amp;lt;iam_endpoint_for_authentication&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;on-premise-deployment-cassandracassandra&#34;&gt;On premise deployment (Cassandra&#43;Cassandra)&lt;/h3&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;Cassandra as storage backend for chunks and indexes is deprecated.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Keeping this for posterity, but this is likely not a common config. Cassandra should work and could be faster in some situations but is likely much more expensive.&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;storage_config:
  cassandra:
    addresses: &amp;lt;comma-separated-IPs-or-hostnames&amp;gt;
    keyspace: &amp;lt;keyspace&amp;gt;
    auth: &amp;lt;true|false&amp;gt;
    username: &amp;lt;username&amp;gt; # only applicable when auth=true
    password: &amp;lt;password&amp;gt; # only applicable when auth=true

schema_config:
  configs:
    - from: 2020-07-01
      store: cassandra
      object_store: cassandra
      schema: v11
      index:
        prefix: index_
        period: 168h
      chunks:
        prefix: chunk_
        period: 168h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;on-premise-deployment-minio-single-store&#34;&gt;On premise deployment (MinIO Single Store)&lt;/h3&gt;
&lt;p&gt;You configure MinIO by using the AWS config because MinIO implements the S3 API:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;storage_config:
  aws:
    # Note: use a fully qualified domain name (fqdn), like localhost.
    # full example: http://loki:supersecret@localhost.:9000
    s3: http&amp;lt;s&amp;gt;://&amp;lt;username&amp;gt;:&amp;lt;secret&amp;gt;@&amp;lt;fqdn&amp;gt;:&amp;lt;port&amp;gt;
    s3forcepathstyle: true
  tsdb_shipper:
    active_index_directory: /loki/index
    cache_location: /loki/index_cache
    cache_ttl: 24h         # Can be increased for faster performance over longer query periods, uses more disk space

schema_config:
  configs:
    - from: 2020-07-01
      store: tsdb
      object_store: s3
      schema: v13
      index:
        prefix: index_
        period: 24h&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="storage">Storage&lt;/h1>
&lt;p>Unlike other logging systems, Grafana Loki is built around the idea of only indexing
metadata about your logs: labels (just like Prometheus labels). Log data itself
is then compressed and stored in chunks in object stores such as S3 or GCS, or
even locally on the filesystem. A small index and highly compressed chunks
simplifies the operation and significantly lowers the cost of Loki.&lt;/p></description></item><item><title>Examples</title><link>https://grafana.com/docs/loki/v3.7.x/configure/examples/</link><pubDate>Thu, 09 Apr 2026 02:28:18 +0000</pubDate><guid>https://grafana.com/docs/loki/v3.7.x/configure/examples/</guid><content><![CDATA[&lt;h1 id=&#34;examples&#34;&gt;Examples&lt;/h1&gt;
&lt;p&gt;The following pages contain examples of how to configure Grafana Loki.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;configuration-examples/&#34;&gt;Configuration snippets and ready-to-use configuration examples&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;query-frontend/&#34;&gt;Deploy a query frontend on a existing cluster&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;./thanos-storage-configs&#34;&gt;Configuration examples for using Thanos-based storage clients&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="examples">Examples&lt;/h1>
&lt;p>The following pages contain examples of how to configure Grafana Loki.&lt;/p>
&lt;ul>
&lt;li>&lt;a href="configuration-examples/">Configuration snippets and ready-to-use configuration examples&lt;/a>.&lt;/li>
&lt;li>&lt;a href="query-frontend/">Deploy a query frontend on a existing cluster&lt;/a>.&lt;/li>
&lt;li>&lt;a href="./thanos-storage-configs">Configuration examples for using Thanos-based storage clients&lt;/a>.&lt;/li>
&lt;/ul></description></item></channel></rss>