public class Grok extends Object implements GrokTemplate
Grok parse arbitrary text and structure it.
Grok is simple API that allows you to easily parse logs
and other files (single line). With Grok,
you can turn unstructured log and event data into structured data.| 限定符和类型 | 字段和说明 |
|---|---|
Map<String,Converter> |
converters |
Map<String,Converters.Type> |
groupTypes |
Set<String> |
namedGroups |
| 构造器和说明 |
|---|
Grok(String pattern,
String namedRegex,
Map<String,String> namedRegexCollection,
Map<String,String> patternDefinitions,
String defaultTimeZone) |
| 限定符和类型 | 方法和说明 |
|---|---|
List<Map<String,Object>> |
extract(List<String> logs)
Match the given list of log with the named regex
and return the list of json representation of the matched elements.
|
Map<String,Object> |
extract(String log)
Match the given log with the named regex.
|
String |
getNamedRegex()
Get the named regex from the
Grok pattern. |
Map<String,String> |
getNamedRegexCollection()
Get the full collection of the named regex.
|
String |
getNamedRegexCollectionById(String id)
Get the named regex from the given id.
|
String |
getOriginalGrokPattern()
Original grok pattern used to compile to the named regex.
|
Map<String,String> |
getPatterns()
Get the current map of
Grok pattern. |
String |
getSavedPattern() |
void |
setSavedPattern(String savedpattern) |
public final Map<String,Converters.Type> groupTypes
public String getSavedPattern()
public void setSavedPattern(String savedpattern)
public Map<String,String> getPatterns()
Grok pattern.public String getNamedRegex()
Grok pattern. public String getOriginalGrokPattern()
public String getNamedRegexCollectionById(String id)
id - : named regex idpublic Map<String,String> getNamedRegexCollection()
public Map<String,Object> extract(String log)
extract 在接口中 GrokTemplatelog - : log to matchCopyright © 2022. All rights reserved.