How to Set Up Log Aggregation for Multiple Servers (ELK Stack Basics)
How to Set Up Log Aggregation for Multiple Servers (ELK Stack Basics) When you have one server, tail -f /var/log/app.log works fine. When you have three servers and something goes wrong, you need t...

Source: DEV Community
How to Set Up Log Aggregation for Multiple Servers (ELK Stack Basics) When you have one server, tail -f /var/log/app.log works fine. When you have three servers and something goes wrong, you need to search logs across all of them simultaneously. That's what log aggregation solves. The Lightweight Alternative First: Loki + Grafana Before we go full ELK, consider Loki — it's significantly lighter and integrates with Grafana (which you may already have from monitoring): # docker-compose.yml for Loki stack version: '3.8' services: loki: image: grafana/loki:2.9.0 ports: - "3100:3100" volumes: - loki-data:/loki promtail: image: grafana/promtail:2.9.0 volumes: - /var/log:/var/log:ro - ./promtail-config.yml:/etc/promtail/config.yml command: -config.file=/etc/promtail/config.yml grafana: image: grafana/grafana:latest ports: - "3000:3000" volumes: loki-data: # promtail-config.yml server: http_listen_port: 9080 positions: filename: /tmp/positions.yaml clients: - url: http://loki:3100/loki/api/v1/