2019-10-24 02:20:38 +02:00
|
|
|
{ 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 {
|
2019-12-20 05:54:26 +01:00
|
|
|
default = [ ];
|
2019-10-24 02:20:38 +02:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
config = mkIf (cfg.rules != [ ]) {
|
2019-10-24 02:20:38 +02:00
|
|
|
graylog.pipeline.mainsorting = {
|
2019-12-20 05:54:26 +01:00
|
|
|
source = let rules = map (rule: " rule \"${rule}\";") cfg.rules;
|
|
|
|
in ''
|
|
|
|
stage 0 match either
|
|
|
|
${concatStringsSep "\n" rules}
|
2019-10-24 02:20:38 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
description = "main sorting pipeline (TF)";
|
|
|
|
streamId = cfg.streamId;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|