git.iko.soy/typeable/nixpkgs
on master help sign in
SystemdJournal2Gelf.service: new service
commit80918692e1d865e75cb2286705d392f12829f728 authorMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> dateThu 25 May 2017, 18:23 (10 years ago) parente1239fd
2 files changed+61−1
nixos/modules/module-list.nix+2−1 nixos/modules/services/logging/SystemdJournal2Gelf.nix+59
nixos/modules/module-list.nix+2−1
@@ -239,8 +239,9 @@
239239 ./services/logging/logrotate.nix
240240 ./services/logging/logstash.nix
241241 ./services/logging/rsyslogd.nix
242− ./services/logging/syslogd.nix
242+ ./services/logging/SystemdJournal2Gelf.nix
243243 ./services/logging/syslog-ng.nix
244+ ./services/logging/syslogd.nix
244245 ./services/mail/dovecot.nix
245246 ./services/mail/dspam.nix
246247 ./services/mail/exim.nix
nixos/modules/services/logging/SystemdJournal2Gelf.nixnew file+59
@@ -0,0 +1,59 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let cfg = config.services.SystemdJournal2Gelf;
6+in
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.string;
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.string;
29+ default = "";
30+ description = ''
31+ Any extra flags to pass to SystemdJournal2Gelf. Note that
32+ these are basically <literal>journalctl</literal> flags.
33+ '';
34+ };
35+
36+ package = mkOption {
37+ type = types.package;
38+ default = pkgs.systemd-journal2gelf;
39+ description = ''
40+ SystemdJournal2Gelf package to use.
41+ '';
42+ };
43+
44+ };
45+ };
46+
47+ config = mkIf cfg.enable {
48+ systemd.services.SystemdJournal2Gelf = {
49+ description = "SystemdJournal2Gelf";
50+ after = [ "network.target" ];
51+ wantedBy = [ "multi-user.target" ];
52+ serviceConfig = {
53+ ExecStart = "${cfg.package}/bin/SystemdJournal2Gelf ${cfg.graylogServer} --follow ${cfg.extraOptions}";
54+ Restart = "on-failure";
55+ RestartSec = "30";
56+ };
57+ };
58+ };
59+}