From c4827d41d35bdd3092d53827675af2114b94beb8 Mon Sep 17 00:00:00 2001 From: Michal Kubenka Date: Sun, 18 Jun 2017 12:46:56 +0200 Subject: [PATCH 1/4] Can't convert array auditLogTrailerMessages to hash. --- 2081_filter_section_h_convert_to_key-value.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2081_filter_section_h_convert_to_key-value.conf b/2081_filter_section_h_convert_to_key-value.conf index 3e404ab..2f857f5 100644 --- a/2081_filter_section_h_convert_to_key-value.conf +++ b/2081_filter_section_h_convert_to_key-value.conf @@ -21,7 +21,7 @@ filter { ruby { code => " auditLogTrailer = event.get('auditLogTrailer').to_hash - auditLogTrailerMessages = event.get('auditLogTrailerMessages').to_hash + auditLogTrailerMessages = event.get('auditLogTrailerMessages') auditLogTrailer.each { |k, v| if !v.nil? and v.is_a? String auditLogTrailer[k] = v.strip From 26594a2d13d03c804565d4f5147a90171bb0b60c Mon Sep 17 00:00:00 2001 From: Michal Kubenka Date: Sun, 18 Jun 2017 12:47:40 +0200 Subject: [PATCH 2/4] Add auditLogTrailer to event. --- 2081_filter_section_h_convert_to_key-value.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/2081_filter_section_h_convert_to_key-value.conf b/2081_filter_section_h_convert_to_key-value.conf index 2f857f5..1741f88 100644 --- a/2081_filter_section_h_convert_to_key-value.conf +++ b/2081_filter_section_h_convert_to_key-value.conf @@ -29,6 +29,8 @@ filter { } auditLogTrailer.delete('Message') auditLogTrailer['messages'] = auditLogTrailerMessages + + event.set('auditLogTrailer', auditLogTrailer) " } From cb91dbd678480da8b7eb662bef7634618942a352 Mon Sep 17 00:00:00 2001 From: Michal Kubenka Date: Sun, 18 Jun 2017 12:48:05 +0200 Subject: [PATCH 3/4] Do not drop whole event just remove auditLogTrailerMessages field. --- 2081_filter_section_h_convert_to_key-value.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2081_filter_section_h_convert_to_key-value.conf b/2081_filter_section_h_convert_to_key-value.conf index 1741f88..8456f41 100644 --- a/2081_filter_section_h_convert_to_key-value.conf +++ b/2081_filter_section_h_convert_to_key-value.conf @@ -34,7 +34,7 @@ filter { " } - drop { + mutate { remove_field => ['auditLogTrailerMessages'] } } From cb985d83407a063e14e26682fc2e63ca8146690e Mon Sep 17 00:00:00 2001 From: Michal Kubenka Date: Sun, 18 Jun 2017 12:48:36 +0200 Subject: [PATCH 4/4] auditLogTrailerMessages is removed in previous section. --- 2089_filter_section_h_example_severities.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2089_filter_section_h_example_severities.conf b/2089_filter_section_h_example_severities.conf index 5535429..6a9f42e 100644 --- a/2089_filter_section_h_example_severities.conf +++ b/2089_filter_section_h_example_severities.conf @@ -11,7 +11,7 @@ filter { ruby { code => " modsecSeverities = Set.new - trailerMsgs = event.get('auditLogTrailerMessages').to_hash + trailerMsgs = event.get('auditLogTrailer[messages]') trailerMsgs.each {|m| if m.key?('severity') modsecSeverities.add(m['severity'])