From e8ff36a1eceb6368dc80bf99812a7cd7085ae541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sat, 21 Nov 2020 15:29:50 +0000 Subject: [PATCH] Add foureighty logs --- nixos/common-services.nix | 12 +++++++++--- nixos/promtail.yaml | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 nixos/promtail.yaml diff --git a/nixos/common-services.nix b/nixos/common-services.nix index f2d08d28..9c428105 100644 --- a/nixos/common-services.nix +++ b/nixos/common-services.nix @@ -1,8 +1,14 @@ { config, pkgs, ... }: { - virtualisation.oci-containers.containers.meditate = { - image = "meditate"; - ports = [ "80:80" ]; + systemd.services.promtail = { + description = "Promtail service for Loki"; + wantedBy = [ "multi-user.target" ]; + + serviceConfig = { + ExecStart = '' + ${pkgs.grafana-loki}/bin/promtail --config.file ${./promtail.yaml} + ''; + }; }; services = { diff --git a/nixos/promtail.yaml b/nixos/promtail.yaml new file mode 100644 index 00000000..57bef2e0 --- /dev/null +++ b/nixos/promtail.yaml @@ -0,0 +1,20 @@ +server: + http_listen_port: 28183 + grpc_listen_port: 0 + +positions: + filename: /tmp/positions.yaml + +clients: + - url: http://vultr1.local:3100/loki/api/v1/push + +scrape_configs: + - job_name: journal + journal: + max_age: 12h + labels: + job: systemd-journal + host: foureighty + relabel_configs: + - source_labels: ["__journal__systemd_unit"] + target_label: "unit"