diff --git a/devenv/docker/blocks/loki-promtail/README.md b/devenv/docker/blocks/loki-promtail/README.md new file mode 100644 index 00000000000..ef92ddbd193 --- /dev/null +++ b/devenv/docker/blocks/loki-promtail/README.md @@ -0,0 +1,10 @@ +NB: This will not work properly on MacOS. The loglines of grafana.log are ingested at the start of this devenv and you won't get any more logs are the Docker service is started. + +By default this block is setup to scrape logs from Grafana. If you need to log some service from the docker-compse you can add: +``` + # For this to work you need to install the logging driver see https://github.com/grafana/loki/tree/master/cmd/docker-driver#plugin-installation + logging: + driver: loki + options: + loki-url: "http://loki:3100/loki/api/v1/push" +``` \ No newline at end of file diff --git a/devenv/docker/blocks/loki-promtail/docker-compose.yaml b/devenv/docker/blocks/loki-promtail/docker-compose.yaml new file mode 100644 index 00000000000..345594cb4ea --- /dev/null +++ b/devenv/docker/blocks/loki-promtail/docker-compose.yaml @@ -0,0 +1,12 @@ + loki: + image: grafana/loki:latest + ports: + - "3100:3100" + command: -config.file=/etc/loki/local-config.yaml + promtail: + image: grafana/promtail:latest + volumes: + - ./docker/blocks/loki-promtail/promtail-config.yaml:/etc/promtail/docker-config.yaml + - ../data/log:/var/log/grafana + command: + -config.file=/etc/promtail/docker-config.yaml \ No newline at end of file diff --git a/devenv/docker/blocks/loki-promtail/promtail-config.yaml b/devenv/docker/blocks/loki-promtail/promtail-config.yaml new file mode 100644 index 00000000000..695fb67275e --- /dev/null +++ b/devenv/docker/blocks/loki-promtail/promtail-config.yaml @@ -0,0 +1,25 @@ +server: + http_listen_port: 9080 + grpc_listen_port: 0 + +positions: + filename: /tmp/positions.yaml + +client: + url: http://loki:3100/api/prom/push + +scrape_configs: +- job_name: system + static_configs: + - targets: + - localhost + labels: + job: varlogs + __path__: /var/log/*log +- job_name: grafana + static_configs: + - targets: + - localhost + labels: + job: grafana + __path__: /var/log/grafana/*log \ No newline at end of file