about summary refs log tree commit diff
path: root/nixos/tests/loki.nix
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2020-11-02 23:35:34 +0100
committerJanne Heß <janne@hess.ooo>2020-11-03 14:36:56 +0100
commit54217cac698fdcf5c047e53054b7d3b039337f02 (patch)
tree66a43099370b2a8d56fa9b051162619f087cbe0c /nixos/tests/loki.nix
parent43b99f23b357681eadd5b00f2eef634b6bf47097 (diff)
nixos/promtail: Add a promtail module
Diffstat (limited to 'nixos/tests/loki.nix')
-rw-r--r--nixos/tests/loki.nix31
1 files changed, 22 insertions, 9 deletions
diff --git a/nixos/tests/loki.nix b/nixos/tests/loki.nix
index dbf1e8a650f5d..eaee717cf87d8 100644
--- a/nixos/tests/loki.nix
+++ b/nixos/tests/loki.nix
@@ -12,15 +12,28 @@ import ./make-test-python.nix ({ lib, pkgs, ... }:
       enable = true;
       configFile = "${pkgs.grafana-loki.src}/cmd/loki/loki-local-config.yaml";
     };
-    systemd.services.promtail = {
-      description = "Promtail service for Loki test";
-      wantedBy = [ "multi-user.target" ];
-
-      serviceConfig = {
-        ExecStart = ''
-          ${pkgs.grafana-loki}/bin/promtail --config.file ${pkgs.grafana-loki.src}/cmd/promtail/promtail-local-config.yaml
-        '';
-        DynamicUser = true;
+    services.promtail = {
+      enable = true;
+      configuration = {
+        server = {
+          http_listen_port = 9080;
+          grpc_listen_port = 0;
+        };
+        clients = [ { url = "http://localhost:3100/loki/api/v1/push"; } ];
+        scrape_configs = [
+          {
+            job_name = "system";
+            static_configs = [
+              {
+                targets = [ "localhost" ];
+                labels = {
+                  job = "varlogs";
+                  __path__ = "/var/log/*log";
+                };
+              }
+            ];
+          }
+        ];
       };
     };
   };