Loki : jouer avec ses logs dans Grafana
Rédigé par dada / 18 juin 2019 / 7 commentaires
Loki
Installation
FROM grafana/loki
COPY local-config.yaml /etc/loki/local-config.yaml
CMD ["/bin/loki", "-config.file=/etc/loki/local-config.yaml"]
auth_enabled: false
server:
http_listen_port: 3100
ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
chunk_idle_period: 15m
schema_config:
configs:
- from: 2018-04-15
store: boltdb
object_store: filesystem
schema: v9
index:
prefix: index_
period: 168h
storage_config:
boltdb:
directory: /tmp/loki/index
filesystem:
directory: /tmp/loki/chunks
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h
chunk_store_config:
max_look_back_period: 0
table_manager:
chunk_tables_provisioning:
inactive_read_throughput: 0
inactive_write_throughput: 0
provisioned_read_throughput: 0
provisioned_write_throughput: 0
index_tables_provisioning:
inactive_read_throughput: 0
inactive_write_throughput: 0
provisioned_read_throughput: 0
provisioned_write_throughput: 0
retention_deletes_enabled: false
retention_period: 0
Exécution
docker run -d -p 3100:3100 loki
root@monito:~# curl 127.0.0.1:3100
404 page not found
Promtail
Installation
FROM grafana/promtail
COPY docker-config.yaml /etc/promtail/docker-config.yaml
ENTRYPOINT ["/usr/bin/promtail", "-config.file=/etc/promtail/docker-config.yaml"]
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://IP_SRV_LOKI:3100/api/prom/push
scrape_configs:
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/*log
Exécution
docker build -t promtail .
docker run -d -p 9095:9095 -v /var/log:/var/log promtail
Grafana
- job_name: nginx
static_configs:
- targets:
- localhost
labels:
job: nginxlogs
__path__: /var/log/nginx/*log
hostname: b2d