[Diary] Loki, Grafana, Prometheus 설정

Shaun.the.sheep·2025년 8월 29일

[Dairy] S.C.C TIL

목록 보기
22/22

들어가기 전....
일단 도커 이미지를 만들어서 진행해보자 - 개인 서버를 만든 보람이 있구만

Loki

docker

  • 명령어

docker run -d \
--name=loki \
-v (Local yml path):/mnt/config \
-p 3100:3100 grafana/loki:3.0.0 \
-config.file=/mnt/config/loki-config.yml

로키의 yml파일은 다음 사이트를 참고하면 설정할 수 있다.

로키 yml 사이트

  • loki-config.yml
auth_enabled: false

server:
  http_listen_port: 3100
  grpc_listen_port: 9096

common:
  instance_addr: 127.0.0.1
  path_prefix: /tmp/loki
  storage:
    filesystem:
      chunks_directory: /tmp/loki/chunks
      rules_directory: /tmp/loki/rules
  replication_factor: 1
  ring:
    kvstore:
      store: inmemory

query_range:
  results_cache:
    cache:
      embedded_cache:
        enabled: true
        max_size_mb: 100

schema_config:
  configs:
    - from: 2020-10-24
      store: tsdb
      object_store: filesystem
      schema: v13
      index:
        prefix: index_
        period: 24h

ruler:
  alertmanager_url: http://localhost:9093

# 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/analytics/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

위의 설정에서 건들 건 아~~~무것도 없었다

Prometheus

docker

  • 명령어
docker run -d \
--name=promethus \
-p 9090:9090 \
-v /current/path/promethus.yml:/etc/prometheus/prometheus.yml \
prom/promethus
  • yml
global:
  scrape_interval: 15s

scrape_configs:
  - job_name: 'spring-boot'
    metrics_path: '${real controller route}'
    static_configs:
            - targets: ['${real Server IP:Port}']

Grafana

docker

  • 명령어
docker run -d --name=grafana -p 3000:3000 grafana/grafana

0개의 댓글