「Loki」- loki.yaml 配置文件

认识

文档:https://grafana.com/docs/loki/latest/configure/

Grafana Loki is configured in a YAML file (usually referred to as loki.yaml ) which contains information on the Loki server and its individual components, depending on which mode Loki is launched in. 简而言之,该文件为 Grafana Loki OSS 配置文件。

组成

limits_config

https://grafana.com/docs/loki/latest/configure/#limits_config

ingestion_rate_strategy: global
ingestion_rate_mb: 1024
ingestion_burst_size_mb: 2048

配置重新加载 | 无需重启

runtime_config

# The limits_config block configures global and per-tenant limits in Loki. The values here can be overridden in the `overrides` section of the runtime_config file

https://grafana.com/docs/loki/latest/configure/#runtime_config

提供存储配置 Storage

Configuration | Grafana Loki documentation

storage_config | The storage_config block configures one of many possible stores for both the index and chunks. Which configuration to be picked should be defined in schema_config block.

schema_config | Configures the chunk index schema and where it is stored.

period_config | The period_config block configures what index schemas should be used for from specific time periods.

store | store and object_store below affect which <storage_config> key is used. Which index to use. Either tsdb or boltdb-shipper.

object_store | Which store to use for the chunks. Either aws (alias s3), azure, gcs, alibabacloud, bos, cos, swift, filesystem, or a named_store (refer to named_stores_config).

# The storage_config block configures one of many possible stores for both the index and chunks.
# Which configuration to be picked should be defined in schema_config block.
[storage_config: <storage_config>]

# Configures the chunk index schema and where it is stored.
[schema_config: <schema_config>]

[configs: <list of period_configs>]

# store and object_store below affect which <storage_config> key is used. Which
# index to use. Either tsdb or boltdb-shipper.
# Following stores are deprecated: aws, aws-dynamo, gcp, gcp-columnkey, bigtable, bigtable-hashed, cassandra,
# grpc.
[store: <string> | default = “”]

# Which store to use for the chunks. Either aws (alias s3), azure, gcs,
# alibabacloud, bos, cos, swift, filesystem, or a named_store (refer to
# named_stores_config). Following stores are deprecated: aws-dynamo, gcp,
# gcp-columnkey, bigtable, bigtable-hashed, cassandra, grpc.
[object_store: <string> | default = “”]

s3_storage_config https://grafana.com/docs/loki/latest/configure/#s3_storage_config

提供日志等级配置

log_level:

构建

测试配置文件

verify-config does not work as expected · Issue #8346 · grafana/loki

# loki -log.level debug   -verify-config -config.file /etc/loki/local-config.yaml 
level=warn ts=2024-08-08T03:55:13.663966568Z caller=loki.go:288 msg="global timeout not configured, ...
level=info ts=2024-08-08T03:55:13.664243315Z caller=main.go:73 msg="config is valid"