Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
joshuali925 opened this issue Oct 5, 2022 · 1 comment
Open

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

joshuali925 opened this issue Oct 5, 2022 · 1 comment
Labels
enhancement New feature or request PPL Piped processing language

Comments

@joshuali925
Copy link
Member

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

@joshuali925 joshuali925 added the enhancement New feature or request label Oct 5, 2022
@dai-chen dai-chen added the PPL Piped processing language label Oct 6, 2022
@Yury-Fridlyand
Copy link
Collaborator

For reference: introduced in #813

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request PPL Piped processing language
Projects
None yet
Development

No branches or pull requests

3 participants