Skip to content

Commit

Permalink
chore: Update examples to use v13 schema, along with related defaults (
Browse files Browse the repository at this point in the history
…#12402)

Co-authored-by: J Stickler <[email protected]>
  • Loading branch information
paul1r and JStickler authored Mar 29, 2024
1 parent c8c8477 commit b286075
Show file tree
Hide file tree
Showing 24 changed files with 56 additions and 49 deletions.
2 changes: 1 addition & 1 deletion cmd/loki/loki-docker-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ schema_config:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down
2 changes: 1 addition & 1 deletion cmd/loki/loki-local-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ schema_config:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down
2 changes: 1 addition & 1 deletion cmd/loki/loki-local-experimental-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ schema_config:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down
2 changes: 1 addition & 1 deletion cmd/loki/loki-local-with-memcached.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ schema_config:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down
20 changes: 10 additions & 10 deletions docs/sources/configure/examples/configuration-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ schema_config:
- from: 2020-05-15
store: tsdb
object_store: filesystem
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down Expand Up @@ -71,7 +71,7 @@ schema_config:
- from: 2020-05-15
store: tsdb
object_store: s3
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down Expand Up @@ -127,7 +127,7 @@ schema_config:
- from: 2020-05-15
store: tsdb
object_store: gcs
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand All @@ -154,7 +154,7 @@ schema_config:
- from: 2020-05-15
store: tsdb
object_store: bos
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down Expand Up @@ -203,12 +203,12 @@ schema_config:
period: 24h
prefix: index_

# Starting from 2023-6-15 Loki should store indexes on TSDB with the v12 schema
# Starting from 2023-6-15 Loki should store indexes on TSDB with the v13 schema
# using daily periodic tables and chunks on AWS S3.
- from: "2023-06-15"
store: tsdb
object_store: s3
schema: v12
schema: v13
index:
period: 24h
prefix: index_
Expand All @@ -227,7 +227,7 @@ schema_config:
- from: 2020-05-15
store: tsdb
object_store: alibabacloud
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down Expand Up @@ -297,7 +297,7 @@ schema_config:
- from: 2020-10-01
store: tsdb
object_store: cos
schema: v12
schema: v13
index:
period: 24h
prefix: index_
Expand Down Expand Up @@ -327,7 +327,7 @@ schema_config:
- from: 2020-10-01
store: tsdb
object_store: cos
schema: v12
schema: v13
index:
period: 24h
prefix: index_
Expand Down Expand Up @@ -364,7 +364,7 @@ schema_config:
- from: 2020-10-01
store: tsdb
object_store: cos
schema: v12
schema: v13
index:
period: 24h
prefix: index_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ schema_config:
- from: 2020-05-15
store: tsdb
object_store: filesystem
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ schema_config:
- from: 2020-10-01
store: tsdb
object_store: cos
schema: v12
schema: v13
index:
period: 24h
prefix: index_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ schema_config:
- from: 2020-10-01
store: tsdb
object_store: cos
schema: v12
schema: v13
index:
period: 24h
prefix: index_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ schema_config:
- from: 2020-10-01
store: tsdb
object_store: cos
schema: v12
schema: v13
index:
period: 24h
prefix: index_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ schema_config:
- from: 2020-05-15
store: tsdb
object_store: s3
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/configure/examples/yaml/4-GCS-Example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ schema_config:
- from: 2020-05-15
store: tsdb
object_store: gcs
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/configure/examples/yaml/5-BOS-Example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ schema_config:
- from: 2020-05-15
store: tsdb
object_store: bos
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ schema_config:
period: 24h
prefix: index_

# Starting from 2023-6-15 Loki should store indexes on TSDB with the v12 schema
# Starting from 2023-6-15 Loki should store indexes on TSDB with the v13 schema
# using daily periodic tables and chunks on AWS S3.
- from: "2023-06-15"
store: tsdb
object_store: s3
schema: v12
schema: v13
index:
period: 24h
prefix: index_
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ schema_config:
- from: 2020-05-15
store: tsdb
object_store: alibabacloud
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down
4 changes: 2 additions & 2 deletions docs/sources/operations/storage/retention.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ schema_config:
period: 24h
prefix: index_
object_store: gcs
schema: v12
schema: v13
store: tsdb
storage_config:
tsdb_shipper:
Expand Down Expand Up @@ -238,7 +238,7 @@ schema_config:
- from: 2018-04-15
store: tsdb
object_store: gcs
schema: v12
schema: v13
index:
prefix: loki_index_
period: 24h
Expand Down
4 changes: 2 additions & 2 deletions docs/sources/operations/storage/schema/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Here are items to consider when changing the schema; if schema changes are not d

Be aware of your relation to UTC when using the current date. Make sure that UTC 00:00:00 has not already passed for your current date.

As an example, assume that the current date is 2022-04-10, and you want to update to the v12 schema, so you restart Loki with 2022-04-11 as the `from` date for the new schema. If you forget to take into account that your timezone is UTC -5:00 and it’s currently 20:00 hours in your local timezone, that is actually 2022-04-11T01:00:00 UTC. When Loki starts it will see the new schema and begin to write and store objects following that new schema. If you then try to query data that was written between 00:00:00 and 01:00:00 UTC, Loki will use the new schema and the data will be unreadable, because it was created with the previous schema.
As an example, assume that the current date is 2022-04-10, and you want to update to the v13 schema, so you restart Loki with 2022-04-11 as the `from` date for the new schema. If you forget to take into account that your timezone is UTC -5:00 and it’s currently 20:00 hours in your local timezone, that is actually 2022-04-11T01:00:00 UTC. When Loki starts it will see the new schema and begin to write and store objects following that new schema. If you then try to query data that was written between 00:00:00 and 01:00:00 UTC, Loki will use the new schema and the data will be unreadable, because it was created with the previous schema.

- You cannot undo or roll back a schema change.

Expand All @@ -46,6 +46,6 @@ schema_config:
period: 24h
prefix: loki_ops_index_
object_store: gcs
schema: v12
schema: v13
store: tsdb
```
2 changes: 1 addition & 1 deletion docs/sources/operations/storage/tsdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ schema_config:
period: 24h
prefix: index_
object_store: gcs
schema: v12
schema: v13
store: tsdb

storage_config:
Expand Down
4 changes: 2 additions & 2 deletions docs/sources/setup/migrate/migrate-to-tsdb/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ schema_config:
- from: 2023-10-20 ①
store: tsdb ②
object_store: filesystem ③
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand All @@ -51,7 +51,7 @@ schema_config:

③ This sample configuration uses filesystem as the storage in both the periods. If you want to use a different storage for the TSDB index and chunks, you can specify a different `object_store` in the new period.

④ Update the schema to v12 which is the recommended version at the time of writing. Please refer to the [configure page]({{< relref "../../../configure#period_config" >}}) for the current recommend version.
④ Update the schema to v13 which is the recommended version at the time of writing. Please refer to the [configure page]({{< relref "../../../configure#period_config" >}}) for the current recommend version.

### Configure TSDB shipper

Expand Down
22 changes: 11 additions & 11 deletions docs/sources/storage/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ This storage type for indexes is deprecated and may be removed in future major v
## Schema Config

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 _schemas_ 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 v12 schema starting 2023-07-01:
For instance, this is what it looks like when migrating from BoltDB with v11 schema to TSDB with v13 schema starting 2023-07-01:

```yaml
schema_config:
Expand All @@ -142,13 +142,13 @@ schema_config:
- from: 2023-07-01
store: tsdb
object_store: filesystem
schema: v12
schema: v13
index:
prefix: index_
period: 24h
```
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 v12 schema. This dramatically simplifies upgrading, ensuring it's simple to take advantage of new storage optimizations. These configs should be immutable for as long as you care about retention.
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's simple to take advantage of new storage optimizations. These configs should be immutable for as long as you care about retention.
## Table Manager (deprecated)
Expand Down Expand Up @@ -190,7 +190,7 @@ When a new schema is released and you want to gain the advantages it provides, y

First, you'll want to create a new [period_config]({{< relref "../configure#period_config" >}}) entry in your [schema_config]({{< relref "../configure#schema_config" >}}). The important thing to remember here is to set this at some point in the _future_ 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't queried as if it adheres to the new schema.

As an example, let's say it's 2023-07-14 and we want to start using the `v12` schema on the 20th:
As an example, let's say it's 2023-07-14 and we want to start using the `v13` schema on the 20th:
```yaml
schema_config:
configs:
Expand All @@ -204,7 +204,7 @@ schema_config:
- from: 2023-07-20
store: tsdb
object_store: filesystem
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down Expand Up @@ -243,7 +243,7 @@ schema_config:
- from: 2020-07-01
store: tsdb
object_store: gcs
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand All @@ -266,7 +266,7 @@ schema_config:
- from: 2020-07-01
store: tsdb
object_store: aws
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down Expand Up @@ -352,7 +352,7 @@ schema_config:
period: 24h
prefix: index_
object_store: azure
schema: v12
schema: v13
store: tsdb
storage_config:
azure:
Expand Down Expand Up @@ -388,7 +388,7 @@ schema_config:
period: 24h
prefix: index_
object_store: azure
schema: v12
schema: v13
store: tsdb
storage_config:
azure:
Expand Down Expand Up @@ -420,7 +420,7 @@ schema_config:
period: 24h
prefix: loki_index_
object_store: cos
schema: v12
schema: v13
store: tsdb

storage_config:
Expand Down Expand Up @@ -489,7 +489,7 @@ schema_config:
- from: 2020-07-01
store: tsdb
object_store: s3
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down
2 changes: 1 addition & 1 deletion examples/getting-started/loki-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ schema_config:
- from: 2021-08-01
store: tsdb
object_store: s3
schema: v12
schema: v13
index:
prefix: index_
period: 24h
Expand Down
7 changes: 7 additions & 0 deletions production/docker/config/loki.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ schema_config:
index:
prefix: index_
period: 24h
- from: 2024-03-29
store: tsdb
object_store: s3
schema: v13
index:
prefix: index_
period: 24h


limits_config:
Expand Down
Loading

0 comments on commit b286075

Please sign in to comment.