system-slow-regexes

Retrieves regex execution statistics for queries that experienced regular expression processing delays.

Command properties

PropertyDescription
Command typeDriver query
Required permissionNone
License usageNot counted
Parallel executionNot supported
Distributed executionNot supported

Syntax

system-slow-regexes

Options

None

Output fields

FieldTypeDescription
idlongUnique identifier of the statistics entry
created_attimestampTime the statistics entry was first created
last_updatetimestampTime the statistics entry was last updated
query_idintegerID of the query where the delay occurred
query_sourcestringSource of the query where the delay occurred
query_stringstringFull query string of the query where the delay occurred
regex_originstringOriginal location where the regular expression is defined
patternstringRegular expression pattern where the delay occurred
re2j_startedlongNumber of RE2J engine executions
re2j_finishedlongNumber of RE2J engine successful completions
re2j_successlongNumber of RE2J engine successes
jdk_startedlongNumber of JDK regex engine executions
jdk_finishedlongNumber of JDK regex engine successful completions
jdk_successlongNumber of JDK regex engine successes
jdk_cancellongNumber of JDK regex engine cancellations
jdk_step_limitlongNumber of JDK regex engine step limit exceeded occurrences

Error codes

Parsing errors

N/A

Runtime errors

N/A

Description

The system-slow-regexes command retrieves execution statistics for queries that experienced regular expression processing delays. Logpresso first attempts to process regular expressions using the RE2J engine, and falls back to the JDK engine for patterns that RE2J does not support.

When regular expressions that take a long time to process are detected in the JDK engine, their statistics are recorded. High values for jdk_cancel or jdk_step_limit may indicate that the regular expression pattern has a ReDoS (Regular Expression Denial of Service) vulnerability.

Examples

  1. Retrieve all slow regex statistics

    system-slow-regexes
    

    Retrieves all statistics for regular expression processing delays.

  2. Retrieve patterns with the most step limit exceeded occurrences

    system-slow-regexes | sort -jdk_step_limit
    

    Sorts regular expression patterns from most to fewest JDK engine step limit exceeded occurrences.

  3. Retrieve regular expressions with cancellations

    system-slow-regexes | search jdk_cancel > 0
    

    Retrieves only regular expression patterns that have a history of cancellation in the JDK engine.