From 567ff8902c9770afc70f9d0162acd8fdf507f212 Mon Sep 17 00:00:00 2001 From: iFargle Date: Fri, 30 Jun 2023 17:59:07 +0900 Subject: [PATCH] Test --- laptop/promtail.nix | 86 +++++++++++++++------------------------------ 1 file changed, 28 insertions(+), 58 deletions(-) diff --git a/laptop/promtail.nix b/laptop/promtail.nix index eded85a6..ff53f8e0 100644 --- a/laptop/promtail.nix +++ b/laptop/promtail.nix @@ -11,64 +11,34 @@ services.promtail = { enable = true; configuration = { - { - "positions": { - "filename": "/tmp/positions.yaml" - }, - "clients": [ - { - "url": "https://loki.sysctl.io/loki/api/v1/push", - "basic_auth": { - "username": "loki-sa", - "password": https://nixos.wiki/wiki/Comparison_of_secret_managing_schemes - } - } - ], - "scrape_configs": [ - { - "job_name": "system", - "static_configs": [ - { - "targets": [ - "localhost" - ], - "labels": { - "job": "varlogs", - "__path__": "/host/var/log/*.log" - } - } - ], - "pipeline_stages": [ - { - "static_labels": { - "host": "nixos-p1" - } - } - ] - }, - { - "job_name": "secure", - "static_configs": [ - { - "targets": [ - "localhost" - ], - "labels": { - "job": "varlogs", - "__path__": "/host/var/log/secure" - } - } - ], - "pipeline_stages": [ - { - "static_labels": { - "host": "nixos-p1" - } - } - ] - } - ] - } + server = { + http_listen_port = 3031; + grpc_listen_port = 0; + }; + positions = { + filename = "/tmp/positions.yaml"; + }; + clients = [{ + url = "https://loki.sysctl.io/loki/api/v1/push"; + basic_auth = { + username = loki-sa; + password = null; # https://nixos.wiki/wiki/Comparison_of_secret_managing_schemes; + } + }]; + scrape_configs = [{ + job_name = "journal"; + journal = { + max_age = "12h"; + labels = { + job = "systemd-journal"; + host = "nixos-p1"; + }; + }; + relabel_configs = [{ + source_labels = [ "__journal__systemd_unit" ]; + target_label = "unit"; + }]; + }]; }; }; } \ No newline at end of file