Skip to content

Commit

Permalink
x-pack/winlogbeat/module/powershell: improve details regexp pattern p…
Browse files Browse the repository at this point in the history
…erformance (#36178)

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.
  • Loading branch information
efd6 authored Jul 31, 2023
1 parent c7d5920 commit d8db41b
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 @@ -188,6 +188,7 @@ automatic splitting at root level, if root level element is an array. {pull}3415

*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 d8db41b

Please sign in to comment.