From 1703fded8f95f91355600e49e8e3cbc320ce5fa2 Mon Sep 17 00:00:00 2001 From: Kevin Retzke Date: Sat, 8 May 2021 19:50:28 -0500 Subject: [PATCH] add loki and promtail to collect logs --- docker-compose.yml | 11 +++++++++++ promtail/Dockerfile | 2 ++ promtail/promtail.yaml | 25 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 promtail/Dockerfile create mode 100644 promtail/promtail.yaml diff --git a/docker-compose.yml b/docker-compose.yml index 8fc49a0..765e0ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,17 @@ services: volumes: - prom_data:/prometheus network_mode: host + loki: + image: grafana/loki:2.0.0 + command: -config.file=/etc/loki/local-config.yaml + network_mode: host + promtail: + build: promtail + volumes: + - ${HOME}/.chia/mainnet/log:/var/log/chia + - ${HOME}/.chia/mainnet/plotter:/var/log/plotter + command: -config.file=/etc/promtail/config.yml + network_mode: host grafana: build: grafana network_mode: host diff --git a/promtail/Dockerfile b/promtail/Dockerfile new file mode 100644 index 0000000..11648ee --- /dev/null +++ b/promtail/Dockerfile @@ -0,0 +1,2 @@ +FROM grafana/promtail:2.0.0 +COPY promtail.yaml /etc/promtail/config.yml diff --git a/promtail/promtail.yaml b/promtail/promtail.yaml new file mode 100644 index 0000000..52c20eb --- /dev/null +++ b/promtail/promtail.yaml @@ -0,0 +1,25 @@ +server: + http_listen_port: 9080 + grpc_listen_port: 0 + +positions: + filename: /tmp/positions.yaml + +clients: + - url: http://localhost:3100/loki/api/v1/push + +scrape_configs: +- job_name: chia + static_configs: + - targets: + - localhost + labels: + job: chia + __path__: /var/log/chia/* +- job_name: plotter + static_configs: + - targets: + - localhost + labels: + job: plotter + __path__: /var/log/plotter/*