Skip to content

Instantly share code, notes, and snippets.

@dazinator
Forked from lucj/docker-compose.yaml
Created July 18, 2023 12:18
Show Gist options
  • Save dazinator/05ab46bcafbf43e45c0153b83fb8751e to your computer and use it in GitHub Desktop.
Save dazinator/05ab46bcafbf43e45c0153b83fb8751e to your computer and use it in GitHub Desktop.
fluent-bit / loki / grafana on Docker Swarm
version: '3.8'
configs:
loki-conf:
file: ./loki.conf
fluent-bit-conf:
file: ./fluent-bit.conf
networks:
monitoring:
external: true
name: mon_monitoring
volumes:
loki-data:
services:
loki:
image: grafana/loki:2.0.0
networks:
- monitoring
volumes:
- loki-data:/loki
configs:
- source: loki-conf
target: /etc/loki/local-config.yaml
fluent-bit:
image: fluent/fluent-bit:1.6.6
configs:
- source: fluent-bit-conf
target: /fluent-bit/etc/fluent-bit.conf
deploy:
mode: global
environment:
- LOKI_URL=http://loki:3100/loki/api/v1/push
networks:
- monitoring
volumes:
- /var/lib/docker/containers:/var/lib/docker/containers
grafana:
image: grafana/grafana:7.3.3
deploy:
replicas: 1
networks:
- monitoring
ports:
- 3030:3000
[SERVICE]
Flush 10
Log_Level error
Daemon off
Parsers_File parsers.conf
[INPUT]
Name tail
Path /var/lib/docker/containers/*/*.log
Parser docker
Refresh_Interval 10
Mem_Buf_Limit 10MB
Skip_Long_Lines On
[FILTER]
name grep
match *
regex log service
[FILTER]
Name parser
Match *
Key_Name log
Parser json
[OUTPUT]
name loki
match *
host loki
labels job=fluentbit, $service
auth_enabled: false
server:
http_listen_port: 3100
log_level: warn
ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 5m
chunk_retain_period: 30s
schema_config:
configs:
- from: 2020-05-15
store: boltdb
object_store: filesystem
schema: v11
index:
prefix: index_
period: 168h
storage_config:
boltdb:
directory: /loki/index
filesystem:
directory: /loki/chunks
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment