Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/validate-loki-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Validate Loki Config
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ついでにconfigを検証するCI書いた。
こんな感じで落ちる。はず

https://github.com/cloudnativedaysjp/observability-infra/actions/runs/22452651849/job/65025207042


on:
push:
paths:
- 'stg/loki/config/**'
- 'prod/loki/config/**'
- '.github/workflows/validate-loki-config.yml'

jobs:
validate:
runs-on: ubuntu-latest
strategy:
matrix:
env: [stg, prod]
steps:
- uses: actions/checkout@v4

- name: Validate Loki config (${{ matrix.env }})
run: |
docker run --rm \
-v "$PWD:/work" -w /work \
grafana/loki:3.0.1 \
-config.file=${{ matrix.env }}/loki/config/config.yml -verify-config
102 changes: 88 additions & 14 deletions prod/loki/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ auth_enabled: false

server:
http_listen_port: 3100
grpc_listen_port: 9096
log_level: info

# 共通設定
common:
path_prefix: /loki
storage:
Expand All @@ -11,9 +14,11 @@ common:
rules_directory: /loki/rules
replication_factor: 1
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory

# スキーマ設定(最重要!)
schema_config:
configs:
- from: 2020-10-24
Expand All @@ -24,18 +29,87 @@ schema_config:
prefix: index_
period: 24h

- from: 2025-10-18
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 1d
path_prefix: loki/tsdb-index/

# 制限設定(v3のデフォルト値に合わせる)
limits_config:
retention_period: 744h # 31 days

# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
#
# Statistics help us better understand how Loki is used, and they show us performance
# levels for most users. This helps us prioritize features and documentation.
# For more information on what's sent, look at
# https://github.com/grafana/loki/blob/main/pkg/usagestats/stats.go
# Refer to the buildReport method to see what goes into a report.
#
# If you would like to disable reporting, uncomment the following lines:
#analytics:
# reporting_enabled: false
# 保持期間
retention_period: 744h # 31日間

# v3で変更されたデフォルト値
max_label_names_per_series: 15
max_line_size: 256KB
max_entries_limit_per_query: 5000
max_streams_per_user: 0 # 無制限
max_global_streams_per_user: 0

# クエリの制限
max_query_length: 721h
max_query_parallelism: 32

# 圧縮設定
compactor:
working_directory: /loki/compactor
compaction_interval: 10m
retention_enabled: true
retention_delete_delay: 2h
retention_delete_worker_count: 150
delete_request_store: filesystem

# テーブルマネージャー(v3では非推奨だが互換性のため残す)
table_manager:
retention_deletes_enabled: true
retention_period: 744h

# Ingester設定
ingester:
wal:
enabled: true
dir: /loki/wal
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 1h
max_chunk_age: 1h
chunk_target_size: 1048576
chunk_retain_period: 30s

# Querier設定
querier:
max_concurrent: 20

# Frontend設定
frontend:
max_outstanding_per_tenant: 2048

# Ruler設定(アラートルール用)
ruler:
storage:
type: local
local:
directory: /loki/rules
rule_path: /loki/rules-temp
alertmanager_url: http://localhost:9093
ring:
kvstore:
store: inmemory

# 新機能の設定(オプション)
# 構造化メタデータを無効化する場合
# limits_config:
# allow_structured_metadata: false

# service_nameラベルの自動付与を無効化する場合
# limits_config:
# discover_service_name: []
102 changes: 88 additions & 14 deletions stg/loki/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ auth_enabled: false

server:
http_listen_port: 3100
grpc_listen_port: 9096
log_level: info

# 共通設定
common:
path_prefix: /loki
storage:
Expand All @@ -11,9 +14,11 @@ common:
rules_directory: /loki/rules
replication_factor: 1
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory

# スキーマ設定(最重要!)
schema_config:
configs:
- from: 2020-10-24
Expand All @@ -24,18 +29,87 @@ schema_config:
prefix: index_
period: 24h

- from: 2025-10-18
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 1d
path_prefix: loki/tsdb-index/

# 制限設定(v3のデフォルト値に合わせる)
limits_config:
retention_period: 744h # 31 days

# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
#
# Statistics help us better understand how Loki is used, and they show us performance
# levels for most users. This helps us prioritize features and documentation.
# For more information on what's sent, look at
# https://github.com/grafana/loki/blob/main/pkg/usagestats/stats.go
# Refer to the buildReport method to see what goes into a report.
#
# If you would like to disable reporting, uncomment the following lines:
#analytics:
# reporting_enabled: false
# 保持期間
retention_period: 744h # 31日間

# v3で変更されたデフォルト値
max_label_names_per_series: 15
max_line_size: 256KB
max_entries_limit_per_query: 5000
max_streams_per_user: 0 # 無制限
max_global_streams_per_user: 0

# クエリの制限
max_query_length: 721h
max_query_parallelism: 32

# 圧縮設定
compactor:
working_directory: /loki/compactor
compaction_interval: 10m
retention_enabled: true
retention_delete_delay: 2h
retention_delete_worker_count: 150
delete_request_store: filesystem

# テーブルマネージャー(v3では非推奨だが互換性のため残す)
table_manager:
retention_deletes_enabled: true
retention_period: 744h

# Ingester設定
ingester:
wal:
enabled: true
dir: /loki/wal
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 1h
max_chunk_age: 1h
chunk_target_size: 1048576
chunk_retain_period: 30s

# Querier設定
querier:
max_concurrent: 20

# Frontend設定
frontend:
max_outstanding_per_tenant: 2048

# Ruler設定(アラートルール用)
ruler:
storage:
type: local
local:
directory: /loki/rules
rule_path: /loki/rules-temp
alertmanager_url: http://localhost:9093
ring:
kvstore:
store: inmemory

# 新機能の設定(オプション)
# 構造化メタデータを無効化する場合
# limits_config:
# allow_structured_metadata: false

# service_nameラベルの自動付与を無効化する場合
# limits_config:
# discover_service_name: []