Skip to content

Commit

Permalink
[8.9](backport #36178) x-pack/winlogbeat/module/powershell: improve d…
Browse files Browse the repository at this point in the history
…etails regexp pattern performance (#36186)

The details regexp pattern for the powershell data stream was improved
in the windows integration in elastic/integrations#6154 to reduce
backtracking costs that caused regexp costs to exceed the set runtime
limits. The same pattern on other data streams and in winlogbeat was not
updated. This change brings winlogbeat up to date with the change.

(cherry picked from commit d8db41b)
  • Loading branch information
mergify[bot] authored Jul 31, 2023
1 parent 8757c82 commit 3a1e4a4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]

*Winlogbeat*

- Fix powershell details regexp to prevent excessive backtracking when processing command invocations. {pull}36178[36178]

*Functionbeat*

Expand Down
2 changes: 1 addition & 1 deletion x-pack/winlogbeat/module/powershell/ingest/powershell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ processors:
field: param3
source: |-
def parseRawDetail(String raw) {
Pattern detailRegex = /^([^:(]+)\((.+)\)\:\s*(.+)?$/;
Pattern detailRegex = /^([^:(]+)\(([^)]+)\)\:\s*(.+)?$/;
Pattern parameterBindingRegex = /name\=(.+);\s*value\=(.+)$/;
def matcher = detailRegex.matcher(raw);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ processors:
field: Payload
source: |-
def parseRawDetail(String raw) {
Pattern detailRegex = /^(.+)\((.+)\)\:\s*(.+)?$/;
Pattern detailRegex = /^([^:(]+)\(([^)]+)\)\:\s*(.+)?$/;
Pattern parameterBindingRegex = /name\=(.+);\s*value\=(.+)$/;
def matcher = detailRegex.matcher(raw);
Expand Down

0 comments on commit 3a1e4a4

Please sign in to comment.