docs/sources/operations/storage/_index.md
You can read a high level overview of Loki storage here
Grafana Loki needs to store two different types of data: chunks and indexes.
When using Accelerated Search (experimental), then a third data type is used: bloom blocks.
Loki receives logs in separate streams, where each stream is uniquely identified by its tenant ID and its set of labels. As log entries from a stream arrive, they are compressed as chunks and saved in the chunks store. See chunk format for how chunks are stored internally.
The index stores each stream's label set and links them to the individual chunks. Refer to the Loki configuration for details on how to configure the storage and the index.
For more information:
When using S3 as object storage, the following permissions are needed:
s3:ListBuckets3:PutObjects3:GetObjects3:DeleteObject (if running the Single Store (boltdb-shipper) compactor)Resources: arn:aws:s3:::<bucket_name>, arn:aws:s3:::<bucket_name>/*
See the AWS deployment section on the storage page for a detailed setup guide.
{{< admonition type="note" >}} DynamoDB support is deprecated and will be removed in a future release. {{< /admonition >}}
When using DynamoDB for the index, the following permissions are needed:
dynamodb:BatchGetItemdynamodb:BatchWriteItemdynamodb:DeleteItemdynamodb:DescribeTabledynamodb:GetItemdynamodb:ListTagsOfResourcedynamodb:PutItemdynamodb:Querydynamodb:TagResourcedynamodb:UntagResourcedynamodb:UpdateItemdynamodb:UpdateTabledynamodb:CreateTabledynamodb:DeleteTable (if table_manager.retention_period is more than 0s)Resources: arn:aws:dynamodb:<aws_region>:<aws_account_id>:table/<prefix>*
dynamodb:ListTablesResources: *
If you enable autoscaling from table manager, the following permissions are needed:
application-autoscaling:DescribeScalableTargetsapplication-autoscaling:DescribeScalingPoliciesapplication-autoscaling:RegisterScalableTargetapplication-autoscaling:DeregisterScalableTargetapplication-autoscaling:PutScalingPolicyapplication-autoscaling:DeleteScalingPolicyResources: *
iam:GetRoleiam:PassRoleResources: arn:aws:iam::<aws_account_id>:role/<role_name>
When using IBM Cloud Object Storage (COS) as object storage, IAM Writer role is needed.
See the IBM Cloud Object Storage section on the storage page for a detailed setup guide.
// Header
+-----------------------------------+
| Magic Number (uint32, 4 bytes) |
+-----------------------------------+
| Version (1 byte) |
+-----------------------------------+
| Encoding (1 byte) |
+-----------------------------------+
// Blocks
+--------------------+----------------------------+
| block 1 (n bytes) | checksum (uint32, 4 bytes) |
+--------------------+----------------------------+
| block 1 (n bytes) | checksum (uint32, 4 bytes) |
+--------------------+----------------------------+
| ... |
+--------------------+----------------------------+
| block N (n bytes) | checksum (uint32, 4 bytes) |
+--------------------+----------------------------+
// Metas
+------------------------------------------------------------------------------------------------------------------------+
| #blocks (uvarint) |
+--------------------+-----------------+-----------------+------------------+---------------+----------------------------+
| #entries (uvarint) | minTs (uvarint) | maxTs (uvarint) | offset (uvarint) | len (uvarint) | uncompressedSize (uvarint) |
+--------------------+-----------------+-----------------+------------------+---------------+----------------------------+
| #entries (uvarint) | minTs (uvarint) | maxTs (uvarint) | offset (uvarint) | len (uvarint) | uncompressedSize (uvarint) |
+--------------------+-----------------+-----------------+------------------+---------------+----------------------------+
| ... |
+--------------------+-----------------+-----------------+------------------+---------------+----------------------------+
| #entries (uvarint) | minTs (uvarint) | maxTs (uvarint) | offset (uvarint) | len (uvarint) | uncompressedSize (uvarint) |
+--------------------+-----------------+-----------------+------------------+---------------+----------------------------+
| checksum (uint32, 4 bytes) |
+------------------------------------------------------------------------------------------------------------------------+
// Structured Metadata
+---------------------------------+
| #labels (uvarint) |
+---------------+-----------------+
| len (uvarint) | value (n bytes) |
+---------------+-----------------+
| ... |
+---------------+-----------------+
| checksum (uint32, 4 bytes) |
+---------------------------------+
// Footer
+-----------------------+--------------------------+
| len (uint64, 8 bytes) | offset (uint64, 8 bytes) | // offset to Structured Metadata
+-----------------------+--------------------------+
| len (uint64, 8 bytes) | offset (uint64, 8 bytes) | // offset to Metas
+-----------------------+--------------------------+