public class GrokCompiler extends AbstractLifecycle
inited| 构造器和说明 |
|---|
GrokCompiler() |
| 限定符和类型 | 方法和说明 |
|---|---|
GrokTemplate |
compile(String pattern)
Compiles a given Grok pattern and returns a Grok object which can parse the pattern.
|
GrokTemplate |
compile(String pattern,
boolean namedOnly) |
GrokTemplate |
compile(String pattern,
String timeZoneId,
boolean namedOnly)
Compiles a given Grok pattern and returns a Grok object which can parse the pattern.
|
protected void |
doStart()
Subclasses must implement this method with the start behavior.
|
protected void |
doStop()
Subclasses must implement this method with the stop behavior.
|
Map<String,PatternDefinition> |
getPatternDefinitions() |
void |
init() |
void |
register(InputStream input)
Registers multiple pattern definitions from a given inputStream, and decoded as a UTF-8 source.
|
void |
register(InputStream input,
Charset charset)
Registers multiple pattern definitions from a given inputStream.
|
void |
register(Map<String,String> patternDefinitions)
Registers multiple pattern definitions.
|
void |
register(Reader input)
Registers multiple pattern definitions from a given Reader.
|
void |
register(String name,
String pattern)
Registers a new pattern definition.
|
void |
registerDefaultPatterns() |
void |
registerPatternFromClasspath(String path) |
void |
registerPatternFromClasspath(String path,
Charset charset) |
void |
setDefinitionRepository(PatternDefinitionRepository definitionRepository) |
getName, isRunning, setName, shutdown, startup, stopAndExecute, toStringdoInitpublic void setDefinitionRepository(PatternDefinitionRepository definitionRepository)
public Map<String,PatternDefinition> getPatternDefinitions()
public void init()
throws InitializationException
init 在接口中 Initializableinit 在类中 AbstractInitializableInitializationExceptionprotected void doStart()
AbstractLifecycleAbstractLifecycle.lifecycleLock.doStart 在类中 AbstractLifecycleprotected void doStop()
AbstractLifecycleAbstractLifecycle.lifecycleLock.doStop 在类中 AbstractLifecyclepublic void register(String name, String pattern)
name - : Pattern Namepattern - : Regular expression Or Grok patternGrokException - runtime exptpublic void register(Map<String,String> patternDefinitions)
public void registerDefaultPatterns()
public void registerPatternFromClasspath(String path) throws GrokException
GrokExceptionpublic void registerPatternFromClasspath(String path, Charset charset) throws GrokException
GrokExceptionpublic void register(InputStream input) throws IOException
IOExceptionpublic void register(InputStream input, Charset charset) throws IOException
IOExceptionpublic void register(Reader input) throws IOException
IOExceptionpublic GrokTemplate compile(String pattern) throws IllegalArgumentException
public GrokTemplate compile(String pattern, boolean namedOnly) throws IllegalArgumentException
public GrokTemplate compile(String pattern, String timeZoneId, boolean namedOnly) throws IllegalArgumentException
pattern - : Grok pattern (ex: %{IP})timeZoneId - : time zone used to parse a timestamp when it doesn't contain the time zonenamedOnly - : Whether to capture named expressions only or not (i.e. %{IP:ip} but not ${IP})IllegalArgumentException - when pattern definition is invalidCopyright © 2022. All rights reserved.