Skip to content

[FEATURE] Limit/optimize resources used by grok and parse #889

@joshuali925

Description

@joshuali925

Is your feature request related to a problem?
CodeQL says the regex to extract grok patterns is not efficient enough

public static final Pattern GROK_PATTERN = Pattern.compile(
"%\\{"
+ "(?<name>"
+ "(?<pattern>[A-z0-9]+)"
+ "(?::(?<subname>[A-z0-9_:;,\\-\\/\\s\\.']+))?"
+ ")"
+ "(?:=(?<definition>"
+ "(?:"
+ "(?:[^{}]+|\\.+)+"
+ ")+"
+ ")"
+ ")?"
+ "\\}");

Additionally parse command's regex is only limited by circuit breaker.

Might be possible to add some more checks, or use https://github.com/google/re2j for better worst case performance

Metadata

Metadata

Assignees

No one assigned

    Labels

    PPLPiped processing languageenhancementNew feature or request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions