2021-07-15 08:59:44 +02:00
|
|
|
with builtins; {
|
|
|
|
|
|
|
|
resource = {
|
|
|
|
|
|
|
|
graylog_pipeline_connection = {
|
2021-07-15 23:09:55 +02:00
|
|
|
journald.pipeline_ids = [ "\${graylog_pipeline.nextcloud.id}" ];
|
2021-07-15 08:59:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
graylog_pipeline = {
|
|
|
|
nextcloud.source = ''
|
|
|
|
pipeline "nextcloud : parsing"
|
|
|
|
stage 10 match either
|
|
|
|
rule "nextcloud : parse level 1"
|
2021-07-15 23:09:55 +02:00
|
|
|
stage 11 match either
|
|
|
|
rule "nextcloud : parse level 2"
|
2021-07-17 13:45:19 +02:00
|
|
|
stage 12 match either
|
|
|
|
rule "nextcloud : parse level 3"
|
2021-07-15 08:59:44 +02:00
|
|
|
end
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
graylog_pipeline_rule = {
|
|
|
|
nextcloudLevel1.source = ''
|
|
|
|
rule "nextcloud : parse level 1"
|
|
|
|
when
|
2021-07-17 13:45:19 +02:00
|
|
|
has_field("systemd_unit") && ($message.systemd_unit == "phpfpm-nextcloud.service" || $message.systemd_unit == "nextcloud-cron.service") && starts_with(to_string($message.message),"{")
|
2021-07-15 08:59:44 +02:00
|
|
|
then
|
|
|
|
let parsedJson = parse_json(to_string($message.message));
|
|
|
|
set_fields(to_map(parsedJson),"nextcloud_");
|
|
|
|
end
|
|
|
|
'';
|
2021-07-17 13:45:19 +02:00
|
|
|
#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
|
|
|
|
#'';
|
2021-07-15 23:09:55 +02:00
|
|
|
nextcloudLevel2.source = ''
|
|
|
|
rule "nextcloud : parse level 2"
|
|
|
|
when
|
2021-07-17 13:45:19 +02:00
|
|
|
has_field("nextcloud_message")
|
2021-07-15 23:09:55 +02:00
|
|
|
then
|
2021-07-17 13:45:19 +02:00
|
|
|
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);
|
2021-07-15 23:09:55 +02:00
|
|
|
end
|
|
|
|
'';
|
2021-07-15 08:59:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|