java.lang.Object
org.elasticsearch.grok.Grok
-
Constructor Summary
ConstructorsConstructorDescriptionGrok
(PatternBank patternBank, String grokPattern, Consumer<String> logCallBack) Grok
(PatternBank patternBank, String grokPattern, MatcherWatchdog matcherWatchdog, Consumer<String> logCallBack) -
Method Summary
Modifier and TypeMethodDescriptionThe list of values that this Grok can capture.captureRanges
(String text) Matches and returns the ranges of any named captures.Matches and returns any named captures.org.joni.Regex
boolean
match
(byte[] utf8Bytes, int offset, int length, GrokCaptureExtracter extracter) Matches and collects any named captures.boolean
Checks whether a specific text matches the defined grok expression.
-
Constructor Details
-
Grok
-
Grok
public Grok(PatternBank patternBank, String grokPattern, MatcherWatchdog matcherWatchdog, Consumer<String> logCallBack)
-
-
Method Details
-
match
Checks whether a specific text matches the defined grok expression.- Parameters:
text
- the string to match- Returns:
- true if grok expression matches text or there is a timeout, false otherwise.
-
captures
Matches and returns any named captures.- Parameters:
text
- the text to match and extract values from.- Returns:
- a map containing field names and their respective coerced values that matched or null if the pattern didn't match
-
captureRanges
Matches and returns the ranges of any named captures.- Parameters:
text
- the text to match and extract values from.- Returns:
- a map containing field names and their respective ranges that matched or null if the pattern didn't match
-
match
Matches and collects any named captures.- Parameters:
utf8Bytes
- array containing the text to match against encoded in utf-8offset
- offsetutf8Bytes
of the start of the textlength
- length of the text to matchextracter
- collector for captures.GrokCaptureConfig.nativeExtracter(org.elasticsearch.grok.GrokCaptureConfig.NativeExtracterMap<T>)
can build these.- Returns:
- true if there was a match, false otherwise
- Throws:
RuntimeException
- if there was a timeout
-
captureConfig
The list of values that this Grok can capture. -
getCompiledExpression
public org.joni.Regex getCompiledExpression()
-