2019-10-24 02:20:38 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.graylog.stream;
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
|
|
|
options.graylog.stream = mkOption {
|
2019-12-20 05:54:26 +01:00
|
|
|
default = { };
|
|
|
|
type = with types;
|
|
|
|
attrsOf (submodule ({ name, ... }: {
|
|
|
|
options = {
|
|
|
|
title = mkOption {
|
|
|
|
default = name;
|
|
|
|
type = with types; str;
|
|
|
|
};
|
|
|
|
index_set_id = mkOption { type = with types; str; };
|
|
|
|
disabled = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = with types; bool;
|
|
|
|
};
|
|
|
|
matching_type = mkOption {
|
|
|
|
default = "AND";
|
|
|
|
type = with types; str;
|
|
|
|
};
|
|
|
|
pipelines = mkOption {
|
|
|
|
default = [ ];
|
|
|
|
type = with types; listOf str;
|
|
|
|
};
|
2019-10-24 02:20:38 +02:00
|
|
|
};
|
2019-12-20 05:54:26 +01:00
|
|
|
}));
|
2019-10-24 02:20:38 +02:00
|
|
|
};
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
config = mkIf (cfg != { }) {
|
|
|
|
resource.graylog_stream = mapAttrs (name: value: {
|
|
|
|
inherit (value) title index_set_id disabled matching_type;
|
|
|
|
}) cfg;
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
resource.graylog_pipeline_connection = mapAttrs (name: pipelineConfig: {
|
|
|
|
stream_id = "\${graylog_stream.${name}.id}";
|
|
|
|
pipeline_ids = pipelineConfig.pipelines;
|
|
|
|
}) cfg;
|
2019-10-24 02:20:38 +02:00
|
|
|
};
|
|
|
|
}
|