diff options
| author | seth <[email protected]> | 2024-02-07 18:03:24 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2024-02-07 18:27:45 -0500 |
| commit | cffffeb678e9a1078eeba0f19c9607cda9f31bed (patch) | |
| tree | 8b8f68aa357becad06845f15b7e528474041371c /modules/nixos/traits/promtail.nix | |
| parent | 48712d44fde91d2685089cca7f9d88295fd59817 (diff) | |
modules/nixos+darwin: move to traits + archetypes model
Diffstat (limited to 'modules/nixos/traits/promtail.nix')
| -rw-r--r-- | modules/nixos/traits/promtail.nix | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/modules/nixos/traits/promtail.nix b/modules/nixos/traits/promtail.nix new file mode 100644 index 0000000..5e08b25 --- /dev/null +++ b/modules/nixos/traits/promtail.nix @@ -0,0 +1,49 @@ +{ + config, + lib, + ... +}: let + cfg = config.traits.promtail; + inherit (lib) types; +in { + options.traits.promtail = { + enable = lib.mkEnableOption "Promtail"; + + clients = lib.mkOption { + type = types.listOf types.attrs; + default = [{}]; + description = "clients for promtail"; + }; + }; + + config = lib.mkIf cfg.enable { + services.promtail = { + enable = true; + configuration = { + inherit (cfg) clients; + server.disable = true; + + scrape_configs = [ + { + job_name = "journal"; + + journal = { + max_age = "12h"; + labels = { + job = "systemd-journal"; + host = "${config.networking.hostName}"; + }; + }; + + relabel_configs = [ + { + source_labels = ["__journal__systemd_unit"]; + target_label = "unit"; + } + ]; + } + ]; + }; + }; + }; +} |
