diff options
author | azahi <azat@bahawi.net> | 2025-02-17 02:21:56 +0300 |
---|---|---|
committer | azahi <azat@bahawi.net> | 2025-02-17 02:21:56 +0300 |
commit | 59180328cda59817d71cd58c8f48ead047375064 (patch) | |
tree | 2cdd7d1bfa309839ef624c19daf283f510aacf69 /modules/promtail.nix | |
parent | 2025-02-05 (diff) |
2025-02-17
Diffstat (limited to '')
-rw-r--r-- | modules/promtail.nix | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/modules/promtail.nix b/modules/promtail.nix index 65d88d4..cf4eb3b 100644 --- a/modules/promtail.nix +++ b/modules/promtail.nix @@ -4,34 +4,33 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.promtail; in { options.nixfiles.modules.promtail = { - enable = mkEnableOption "Promtail"; + enable = lib.mkEnableOption "Promtail"; - port = mkOption { + port = lib.mkOption { description = "Port."; - type = with types; port; + type = lib.types.port; default = 30181; }; - loki.url = mkOption { + loki.url = lib.mkOption { description = "Address of a listening Loki service."; - type = with types; str; + type = lib.types.str; default = "https://${config.nixfiles.modules.loki.domain}"; }; - filters = mkOption { + filters = lib.mkOption { description = ''Filters to use with "scrape_config.pipeline_stages".''; - type = with types; listOf attrs; + type = with lib.types; listOf attrs; default = [ ]; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.promtail = { enable = true; @@ -70,11 +69,12 @@ in ( n: let - label = toLower n; + label = lib.toLower n; in { source_labels = [ "__journal_${label}" ]; - target_label = if hasPrefix "_" label then substring 1 (stringLength label - 1) label else label; + target_label = + if lib.hasPrefix "_" label then lib.substring 1 (lib.stringLength label - 1) label else label; } ) [ |