Loki 설치 가이드
정보
Loki 개요 문서에서 배포 모드와 컴포넌트를 먼저 확인할 수 있습니다.
설치
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update grafana \
&& helm search repo grafana/loki -l | head -n 10
helm pull grafana/loki --version 6.30.1
helm show values grafana/loki --version 6.30.1 > loki-6.30.1.yaml
loki-values.yaml
deploymentMode: SimpleScalable
global:
extraArgs:
- -config.expand-env=true
extraEnvFrom: []
loki:
auth_enabled: false
schemaConfig:
configs:
- # 인덱스 생성 시작일, 스키마가 변경되면 변경이 시작되는 날짜
from: "2024-03-31"
store: tsdb
# chunks가 저장되는 저장소로 기본값으로 store 값을 씁니다. aws(alias s3), azure,
# alibabacloud, bos, cos, swift, filesystem, or a named_store
object_store: s3
schema: v13
index:
prefix: loki_index_
period: 24h
storage:
bucketNames:
chunks: loki
ruler: loki
admin: loki
type: s3
s3:
s3ForcePathStyle: true
endpoint: "http://${BUCKET_HOST}:${BUCKET_PORT}"
region: "${BUCKET_REGION}"
accessKeyId: "${AWS_ACCESS_KEY_ID}"
secretAccessKey: "${AWS_SECRET_ACCESS_KEY}"
storage_config:
tsdb_shipper:
active_index_directory: /var/loki/tsdb-index
cache_location: /var/loki/tsdb-cache
cache_ttl: 168h
ingester:
chunk_encoding: snappy
querier:
max_concurrent: 4
limits_config:
max_entries_limit_per_query: 10000
read:
backend:
persistence:
storageClass: ""
write:
persistence:
storageClass: ""
gateway:
podLabels: {}
경고
read(querier, queryFrontend), gateway는 쿼리되는 로그의 양에 따라 OOMKilled가 발생할 수 있으므로 모니터링을 통해 적절한 값을 설정해야 합니다.
loki- Loki Docs / Configure
storagestorage_configingesterqueriermax_concurrent: 4- 성능 개선이 필요하고, 리소스가 충분하다면 늘려볼 수 있습니다.
- OOM 등 문제가 발생하면 줄여볼 수 있습니다.
compactorlimits_config
helm template loki grafana/loki \
--version 6.30.1 \
-n loki \
-f loki-values.yaml \
> loki.yaml
helm upgrade -i loki grafana/loki \
--history-max 5 \
--version 6.30.1 \
-n loki \
-f loki-values.yaml
Grafana
- Configuration -> Data sources -> Add data source -> Loki
- HTTP
- URL:
http://loki-gateway.loki.svc
- URL:
- HTTP
- Explore -> Loki -> Add query
- Builder
- Label filters
{job="fluent-bit"}
- Label filters
- Code
- Log browser:
{job="fluent-bit"} - Log query: https://grafana.com/docs/loki/latest/logql/log_queries/
- LogQL Analyzer: https://grafana.com/docs/loki/latest/logql/analyzer/
- Log browser:
- Builder