Loki needs to store two different types of data: chunks and indexes.
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 GZipped 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 Loki's configuration for details on how to configure the storage and the index.
For more information:
The following are supported for the index:
- Amazon DynamoDB
- Google Bigtable
- Apache Cassandra
- BoltDB (doesn't work when clustering Loki)
The following are supported for the chunks:
- Amazon DynamoDB
- Google Bigtable
- Apache Cassandra
- Amazon S3
- Google Cloud Storage
- Filesystem (doesn't work when clustering Loki)
When using S3 as object storage, the following permissions are needed:
s3:ListBuckets3:PutObjects3:GetObject
Resources: arn:aws:s3:::<bucket_name>, arn:aws:s3:::<bucket_name>/*
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(iftable_manager.retention_periodis more than 0s)
Resources: arn:aws:dynamodb:<aws_region>:<aws_account_id>:table/<prefix>*
dynamodb:ListTables
Resources: *
If you enable autoscaling from table manager, the following permissions are needed:
application-autoscaling:DescribeScalableTargetsapplication-autoscaling:DescribeScalingPoliciesapplication-autoscaling:RegisterScalableTargetapplication-autoscaling:DeregisterScalableTargetapplication-autoscaling:PutScalingPolicyapplication-autoscaling:DeleteScalingPolicy
Resources: *
iam:GetRoleiam:PassRole
Resources: arn:aws:iam::<aws_account_id>:role/<role_name>
-------------------------------------------------------------------
| | |
| MagicNumber(4b) | version(1b) |
| | |
-------------------------------------------------------------------
| block-1 bytes | checksum (4b) |
-------------------------------------------------------------------
| block-2 bytes | checksum (4b) |
-------------------------------------------------------------------
| block-n bytes | checksum (4b) |
-------------------------------------------------------------------
| #blocks (uvarint) |
-------------------------------------------------------------------
| #entries(uvarint) | mint, maxt (varint) | offset, len (uvarint) |
-------------------------------------------------------------------
| #entries(uvarint) | mint, maxt (varint) | offset, len (uvarint) |
-------------------------------------------------------------------
| #entries(uvarint) | mint, maxt (varint) | offset, len (uvarint) |
-------------------------------------------------------------------
| #entries(uvarint) | mint, maxt (varint) | offset, len (uvarint) |
-------------------------------------------------------------------
| checksum(from #blocks) |
-------------------------------------------------------------------
| metasOffset - offset to the point with #blocks |
-------------------------------------------------------------------