From b48ffa332bb9814a04a766072f25e08c3f5abe44 Mon Sep 17 00:00:00 2001 From: Dan Peebles Date: Tue, 8 Aug 2017 22:02:56 +0000 Subject: [PATCH] services.fluentd: add plugins option This allows us to pass in additional ad-hoc fluentd plugins for custom output formats and other goodness. --- nixos/modules/services/logging/fluentd.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/logging/fluentd.nix b/nixos/modules/services/logging/fluentd.nix index 9fbec2457371..95825705d9d7 100644 --- a/nixos/modules/services/logging/fluentd.nix +++ b/nixos/modules/services/logging/fluentd.nix @@ -4,6 +4,8 @@ with lib; let cfg = config.services.fluentd; + + pluginArgs = concatStringsSep " " (map (x: "-p ${x}") cfg.plugins); in { ###### interface @@ -28,6 +30,15 @@ in { defaultText = "pkgs.fluentd"; description = "The fluentd package to use."; }; + + plugins = mkOption { + type = types.listOf types.path; + default = []; + description = '' + A list of plugin paths to pass into fluentd. It will make plugins defined in ruby files + there available in your config. + ''; + }; }; }; @@ -39,7 +50,7 @@ in { description = "Fluentd Daemon"; wantedBy = [ "multi-user.target" ]; serviceConfig = { - ExecStart = "${cfg.package}/bin/fluentd -c ${pkgs.writeText "fluentd.conf" cfg.config}"; + ExecStart = "${cfg.package}/bin/fluentd -c ${pkgs.writeText "fluentd.conf" cfg.config} ${pluginArgs}"; ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; }; };