nixos-config/terranix/graylog/modules/all-messages.nix
2019-12-20 17:54:26 +13:00

43 lines
927 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.graylog.all_messages;
in {
options.graylog.all_messages = {
streamId = mkOption {
type = with types; str;
default = "000000000000000000000001";
description = ''
id of "All Messages" stream;
'';
};
rules = mkOption {
default = [ ];
type = with types; listOf str;
example = [ "route sshd" "route kernel" "mark junk" ];
description = ''
all the rules which should be called on the pipeline operating on the
all_messages input
'';
};
};
config = mkIf (cfg.rules != [ ]) {
graylog.pipeline.mainsorting = {
source = let rules = map (rule: " rule \"${rule}\";") cfg.rules;
in ''
stage 0 match either
${concatStringsSep "\n" rules}
'';
description = "main sorting pipeline (TF)";
streamId = cfg.streamId;
};
};
}