nixos-config/terranix/graylog/modules/all-messages.nix
Ingolf Wagner 54bab918d7
init
2019-10-24 02:24:33 +02:00

46 lines
957 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;
};
};
}