From cdb96661c984db33bcb454f278a97b7634444372 Mon Sep 17 00:00:00 2001 From: Keith Schmitt <32067685+schmikei@users.noreply.github.com> Date: Tue, 28 Sep 2021 16:05:18 -0400 Subject: [PATCH] Updated fields rebase 2 (#344) * Update regex to parse IPv6 (#334) Update default listener log path * Add HAProxy Plugin (#335) * Add haproxy plugin * Add supported platforms and min stanza version * PR Feedback fixes * Rename frontend_name to frontend_name_transport in regex * for all move operations, check if field is nil before moving. "set log type to haproxy and haproxy.error (not .http / .tcp)" * typoe: nill --> nil * typo, log_format: http --> default Co-authored-by: jsirianni * Allow DBID to be empty & Correct case matching (#331) * Allow DBID to be empty & Correct case matching The DBID field is able to be empty on some versions of Oracle DB The multiline regex was looking for `Audit File`, but logs have `Audit file` * Switch to line end for multiline with double newline pattern * Fix plugin failure when using inline truncate check * Switch back to a regex parse for record splitting Co-authored-by: jsirianni * Release 0.0.79 (#336) * 0.0.79 changelog * dbid oracle pr * fix release date * move frontend port to resources (#338) * Add more checks to reduce errors (#337) * Add more checks to reduce errors * Add ac_lite_ap_parser change to changelog for ubiquiti * 0.0.80 changelog Co-authored-by: jsirianni * rebase the stanza-plugins changes * fix haproxy * fix ubiquiti * fix labels rather than attributes on operator field * oracledb attributes * fix haproxy * update regex to handle {} brackets before http request info (#342) * update regex to handle {} brackets before http request info * haproxy http default log format fix * make change backwards compatible * Adjust parsing further based on more detailed oracle db audit logs (#343) * release 0.0.82 Co-authored-by: Dylan Myers Co-authored-by: EricWHolt <39141134+ericwholt@users.noreply.github.com> Co-authored-by: jsirianni Co-authored-by: jsirianni --- CHANGELOG.md | 11 +++++++++++ plugins/haproxy.yaml | 2 +- plugins/oracledb.yaml | 22 ++++++++++++++++++---- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78ca572a..0753c8cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.0.82] 2021-09-28 + +### Fixed + +- OracleDB: Resolved parsing issue related to multiple audit log formats [PR341](https://github.com/observIQ/stanza-plugins/pull/343) + +## [0.0.81] 2021-09-28 + +### Fixed +- HAProxy: Resolved an issue where http logs using default format can fail to parse ([PR342](https://github.com/observIQ/stanza-plugins/pull/342)) + ## [0.0.80] 2021-09-23 ### Fixed diff --git a/plugins/haproxy.yaml b/plugins/haproxy.yaml index eb68bfa4..a4dd7d77 100644 --- a/plugins/haproxy.yaml +++ b/plugins/haproxy.yaml @@ -72,7 +72,7 @@ pipeline: - id: httplog_parser type: regex_parser parse_from: $body.message - regex: '^(\s)?(?P[^:]+):(?P[^\s]+)\s+\[(?P[^\]]+)\]\s+(?P[^\s]+)\s+(?P[^/]+)/(?P[^\s]+)\s+(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^\s]+)\s+(?P[^\s]+)\s+(?P[^\s]+)\s+(?P[^\s]+)\s+(?P[^\s]+)\s+(?P[\w-]{4})\s+(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^\s]+)\s+(?P[^/]+)/(?P[^\s]+)\s+"(?P\S+) +(?P[^ ]*)( (?P[^/]*)/(?P[^\"]*)|[^\"]*)?"' + regex: '^(\s)?(?P[^:]+):(?P[^\s]+)\s+\[(?P[^\]]+)\]\s+(?P[^\s]+)\s+(?P[^/]+)/(?P[^\s]+)\s+(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^\s]+)\s+(?P[^\s]+)\s+(?P[^\s]+)\s+(?P[^\s]+)\s+(?P[^\s]+)\s+(?P[\w-]{4})\s+(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^\s]+)\s+(?P[^/]+)/(?P[^\s]+) ({[\w\d[:ascii:]]+?}\s)?"(?P\S+) +(?P[^ ]*)( (?P[^/]*)/(?P[^\"]*)|[^\"]*)?"' output: frontend_type_http_add - id: frontend_type_http_add diff --git a/plugins/oracledb.yaml b/plugins/oracledb.yaml index 8abe1a1d..21453a6d 100644 --- a/plugins/oracledb.yaml +++ b/plugins/oracledb.yaml @@ -83,14 +83,28 @@ pipeline: - id: audit_router type: router routes: - - output: audit_regex_parser - expr: $ matches '\\w+ \\w+\\s{1,2}\\d{1,2} \\d{2}:\\d{2}:\\d{2} \\d{4} [-+]\\d{2}:\\d{2}' + - output: audit_regex_parser_action + expr: $ matches '\\w+ \\w+\\s{1,2}\\d{1,2} \\d{2}:\\d{2}:\\d{2} \\d{4} [-+]\\d{2}:\\d{2}\\nLENGTH\\s:\\s\\D\\d+\\D\\nACTION' + - output: audit_regex_parser_session + expr: $ matches '\\w+ \\w+\\s{1,2}\\d{1,2} \\d{2}:\\d{2}:\\d{2} \\d{4} [-+]\\d{2}:\\d{2}\\nLENGTH:\\s\\D\\d+\\D\\nSESSION' - output: server_start_regex_parser expr: $ startsWith 'Audit file ' - - id: audit_regex_parser + - id: audit_regex_parser_action type: regex_parser - regex: '(?P\w+ \w+\s{1,2}\d{1,2} \d{2}:\d{2}:\d{2} \d{4} [-+]\d{2}:\d{2})\nLENGTH : \D(?P\d*)\D\nACTION :\[\d+\]\s+\D(?P[\d\w[:ascii:]]+)\D\nDATABASE USER:\[\d+\]\s+\D(?P[^\s]+)\D\n(PRIVILEGE :\[\d+\]\s+\D(?P[^\s]+)\D\n)?(CLIENT USER:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(CLIENT TERMINAL:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(STATUS:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(DBID:\[\d+\]\s\D(?P\d+|)\D\n)?(SESSIONID:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(USERHOST:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(CLIENT ADDRESS:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(ACTION NUMBER:\[\d+\]\s+\D(?P[^\s]+|)\D)?' + regex: '^(?P\w+ \w+\s{1,2}\d{1,2} \d{2}:\d{2}:\d{2} \d{4} [-+]\d{2}:\d{2})\nLENGTH : \D(?P\d*)\D\nACTION :\[\d+\]\s+\D(?P[\d\w[:ascii:]]+?)\D\nDATABASE USER:\[\d+\]\s+\D(?P[^\s]+)\D\n(PRIVILEGE :\[\d+\]\s+\D(?P[^\s]+)\D\n)?(CLIENT USER:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(CLIENT TERMINAL:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(STATUS:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(DBID:\[\d+\]\s\D(?P[^\s]+|)\D\n)?(SESSIONID:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(USERHOST:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(CLIENT ADDRESS:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?(ACTION NUMBER:\[\d+\]\s+\D(?P[^\s]+|)\D\n)?' + timestamp: + parse_from: timestamp + layout: '%a %h %g %H:%M:%S %Y %j' + # {{ if $enable_truncate_audit_action }} + output: audit_action_restructurer + # {{ else }} + output: {{ .output }} + # {{ end }} + + - id: audit_regex_parser_session + type: regex_parser + regex: '^(?P\w+ \w+\s{1,2}\d{1,2} \d{2}:\d{2}:\d{2} \d{4} [-+]\d{2}:\d{2})\nLENGTH: \D(?P\d*)\D\n(SESSIONID:\[\d+\]\s+\D(?P[^\s]+|)\D[\n\s]+)?(ENTRYID:\[\d+\]\s+\D(?P[^\s]+|)\D[\n\s]+)?(STATEMENT:\[\d+\]\s+\D(?P[^\s]+|)\D[\n\s]+)?(USERID:\[\d+\]\s+\D(?P[^\s]+|)\D[\n\s]+)?(USERHOST:\[\d+\]\s+\D(?P[^\s]+|)\D[\n\s]+)?(TERMINAL:\[\d+\]\s+\D(?P[\d\w[:ascii:]]+?|)\D[\n\s]+)?ACTION:\[\d+\]\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