about summary refs log tree commit diff
path: root/modules/nixos/promtail.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/nixos/promtail.nix42
1 files changed, 30 insertions, 12 deletions
diff --git a/modules/nixos/promtail.nix b/modules/nixos/promtail.nix
index c038d7b..a3a6fe9 100644
--- a/modules/nixos/promtail.nix
+++ b/modules/nixos/promtail.nix
@@ -37,6 +37,8 @@ in {
         clients = [
           {
             url = "${cfg.loki.url}/loki/api/v1/push";
+            batchwait = "15s";
+            batchsize = 1000000;
             external_labels.host_id = config.networking.hostId;
           }
         ];
@@ -46,7 +48,7 @@ in {
         scrape_configs = [
           {
             job_name = "journal";
-            journal.max_age = "24h";
+            journal.max_age = "12h";
             relabel_configs =
               map (n: let
                 label = toLower n;
@@ -63,18 +65,18 @@ in {
                 # [2]: https://github.com/coreos/go-systemd/blob/main/sdjournal/journal.go#L335
 
                 "MESSAGE"
-                "MESSAGE_ID"
-                "PRIORITY"
+                # "MESSAGE_ID"
+                # "PRIORITY"
                 # "CODE_FILE"
                 # "CODE_LINE"
                 # "CODE_FUNC"
-                "ERRNO"
-                "SYSLOG_FACILITY"
+                # "ERRNO"
+                # "SYSLOG_FACILITY"
                 "SYSLOG_IDENTIFIER"
-                "SYSLOG_PID"
-                "_PID"
-                "_UID"
-                "_GID"
+                # "SYSLOG_PID"
+                # "_PID"
+                # "_UID"
+                # "_GID"
                 # "_COMM"
                 # "_EXE"
                 "_CMDLINE"
@@ -89,14 +91,30 @@ in {
                 # "_SYSTEMD_SLICE"
                 # "_SELINUX_CONTEXT"
                 # "_SOURCE_REALTIME_TIMESTAMP"
-                "_BOOT_ID"
-                "_MACHINE_ID"
+                # "_BOOT_ID"
+                # "_MACHINE_ID"
                 "_HOSTNAME"
-                "_TRANSPORT"
+                # "_TRANSPORT"
                 # "__CURSOR"
                 # "__REALTIME_TIMESTAMP"
                 # "__MONOTONIC_TIMESTAMP"
               ];
+            pipeline_stages = [
+              {
+                match = {
+                  selector = ''{systemd_unit="dendrite.service"} |~ ".*Failed to fetch key for server.*"'';
+                  action = "drop";
+                  drop_counter_reason = "noisy_error";
+                };
+              }
+              {
+                match = {
+                  selector = ''{systemd_unit="dendrite.service"} |~ ".*could not download key for.*"'';
+                  action = "drop";
+                  drop_counter_reason = "noisy_error";
+                };
+              }
+            ];
           }
         ];
       };

Consider giving Nix/NixOS a try! <3