at 24.11-pre 1.3 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let cfg = config.services.SystemdJournal2Gelf; 6in 7 8{ options = { 9 services.SystemdJournal2Gelf = { 10 enable = mkOption { 11 type = types.bool; 12 default = false; 13 description = '' 14 Whether to enable SystemdJournal2Gelf. 15 ''; 16 }; 17 18 graylogServer = mkOption { 19 type = types.str; 20 example = "graylog2.example.com:11201"; 21 description = '' 22 Host and port of your graylog2 input. This should be a GELF 23 UDP input. 24 ''; 25 }; 26 27 extraOptions = mkOption { 28 type = types.separatedString " "; 29 default = ""; 30 description = '' 31 Any extra flags to pass to SystemdJournal2Gelf. Note that 32 these are basically `journalctl` flags. 33 ''; 34 }; 35 36 package = mkPackageOption pkgs "systemd-journal2gelf" { }; 37 38 }; 39 }; 40 41 config = mkIf cfg.enable { 42 systemd.services.SystemdJournal2Gelf = { 43 description = "SystemdJournal2Gelf"; 44 after = [ "network.target" ]; 45 wantedBy = [ "multi-user.target" ]; 46 serviceConfig = { 47 ExecStart = "${cfg.package}/bin/SystemdJournal2Gelf ${cfg.graylogServer} --follow ${cfg.extraOptions}"; 48 Restart = "on-failure"; 49 RestartSec = "30"; 50 }; 51 }; 52 }; 53}