diff options
Diffstat (limited to 'modules/nixos/promtail.nix')
-rw-r--r-- | modules/nixos/promtail.nix | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/modules/nixos/promtail.nix b/modules/nixos/promtail.nix index d52384a..157eb72 100644 --- a/modules/nixos/promtail.nix +++ b/modules/nixos/promtail.nix @@ -21,6 +21,12 @@ in { type = with types; str; default = "https://${config.nixfiles.modules.loki.domain}"; }; + + filters = mkOption { + description = ''Filters to use with "scrape_config.pipeline_stages".''; + type = with types; listOf attrs; + default = []; + }; }; config = mkIf cfg.enable { @@ -56,7 +62,7 @@ in { scrape_configs = [ { job_name = "journal"; - journal.max_age = "12h"; + journal.max_age = "24h"; relabel_configs = map (n: let label = toLower n; @@ -74,12 +80,12 @@ in { "MESSAGE" # "MESSAGE_ID" - # "PRIORITY" + "PRIORITY" # "CODE_FILE" # "CODE_LINE" # "CODE_FUNC" # "ERRNO" - # "SYSLOG_FACILITY" + "SYSLOG_FACILITY" "SYSLOG_IDENTIFIER" # "SYSLOG_PID" # "_PID" @@ -93,8 +99,8 @@ in { # "_AUDIT_LOGINUID" # "_SYSTEMD_CGROUP" # "_SYSTEMD_SESSION" - "_SYSTEMD_UNIT" - "_SYSTEMD_USER_UNIT" + # "_SYSTEMD_UNIT" + # "_SYSTEMD_USER_UNIT" # "_SYSTEMD_OWNER_UID" # "_SYSTEMD_SLICE" # "_SELINUX_CONTEXT" @@ -106,23 +112,16 @@ in { # "__CURSOR" # "__REALTIME_TIMESTAMP" # "__MONOTONIC_TIMESTAMP" + ] + ++ [ + { + # This is weird. I can't find where is this defined in the + # source code but apparently it exists. + source_labels = ["__journal_priority_keyword"]; + target_label = "level"; + } ]; - 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"; - }; - } - ]; + pipeline_stages = cfg.filters; } ]; }; |