nixos-config/terranix/graylog/journald/nextcloud.nix
2021-07-17 13:45:19 +02:00

62 lines
1.8 KiB
Nix

with builtins; {
resource = {
graylog_pipeline_connection = {
journald.pipeline_ids = [ "\${graylog_pipeline.nextcloud.id}" ];
};
graylog_pipeline = {
nextcloud.source = ''
pipeline "nextcloud : parsing"
stage 10 match either
rule "nextcloud : parse level 1"
stage 11 match either
rule "nextcloud : parse level 2"
stage 12 match either
rule "nextcloud : parse level 3"
end
'';
};
graylog_pipeline_rule = {
nextcloudLevel1.source = ''
rule "nextcloud : parse level 1"
when
has_field("systemd_unit") && ($message.systemd_unit == "phpfpm-nextcloud.service" || $message.systemd_unit == "nextcloud-cron.service") && starts_with(to_string($message.message),"{")
then
let parsedJson = parse_json(to_string($message.message));
set_fields(to_map(parsedJson),"nextcloud_");
end
'';
#nextcloudLevel2.source = ''
# rule "nextcloud : parse level 2"
# when
# has_field("nextcloud_message")
# then
# let parsedJson = parse_json(to_string($message.nextcloud_message));
# set_field("message", $message.nextcloud_message);
# set_fields(to_map(parsedJson),"nextcloud_message_");
# end
#'';
nextcloudLevel2.source = ''
rule "nextcloud : parse level 2"
when
has_field("nextcloud_message")
then
set_field("message", $message.nextcloud_message);
end
'';
nextcloudLevel3.source = ''
rule "nextcloud : parse level 3"
when
has_field("nextcloud_message_Message")
then
remove_field("nextcloud_message");
set_field("message", $message.nextcloud_message_Message);
end
'';
};
};
}