diff options
author | Tristan Helmich <tristan.helmich@gmail.com> | 2017-02-22 19:07:11 +0100 |
---|---|---|
committer | Tristan Helmich <tristan.helmich@gmail.com> | 2017-02-23 15:21:29 +0100 |
commit | 742092280623b4f8413d48e8a24ef003a231d078 (patch) | |
tree | 3071954a0765e7ebe0bb7a680a5d52e5e0f5ebab /nixos/modules | |
parent | a43fd5af38582339edc357a4af21407a38848174 (diff) |
graylog module: add plugin support
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/logging/graylog.nix | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/nixos/modules/services/logging/graylog.nix b/nixos/modules/services/logging/graylog.nix index a7785decd19a..95283096662e 100644 --- a/nixos/modules/services/logging/graylog.nix +++ b/nixos/modules/services/logging/graylog.nix @@ -17,9 +17,16 @@ let elasticsearch_discovery_zen_ping_unicast_hosts = ${cfg.elasticsearchDiscoveryZenPingUnicastHosts} message_journal_dir = ${cfg.messageJournalDir} mongodb_uri = ${cfg.mongodbUri} + plugin_dir = /var/lib/graylog/plugins ${cfg.extraConfig} ''; + + glPlugins = pkgs.buildEnv { + name = "graylog-plugins"; + paths = cfg.plugins; + }; + in { @@ -121,6 +128,12 @@ in description = "Any other configuration options you might want to add"; }; + plugins = mkOption { + description = "Extra graylog plugins"; + default = [ ]; + type = types.listOf types.package; + }; + }; }; @@ -146,6 +159,16 @@ in path = [ pkgs.openjdk8 pkgs.which pkgs.procps ]; preStart = '' mkdir -p /var/lib/graylog -m 755 + + rm -rf /var/lib/graylog/plugins || true + mkdir -p /var/lib/graylog/plugins -m 755 + + for declarativeplugin in `ls ${glPlugins}/bin/`; do + ln -sf ${glPlugins}/bin/$declarativeplugin /var/lib/graylog/plugins/$declarativeplugin + done + for includedplugin in `ls ${cfg.package}/plugin/`; do + ln -s ${cfg.package}/plugin/$includedplugin /var/lib/graylog/plugins/$includedplugin || true + done chown -R ${cfg.user} /var/lib/graylog mkdir -p ${cfg.messageJournalDir} -m 755 |