本文整理了Java中oi.thekraken.grok.api.Grok.create()
方法的一些代码示例,展示了Grok.create()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Grok.create()
方法的具体详情如下:
包路径:oi.thekraken.grok.api.Grok
类名称:Grok
方法名:create
暂无
代码示例来源:origin: OpenSOC/opensoc-streaming
public GrokSourcefireParser() throws GrokException
{
URL pattern_url = getClass().getClassLoader().getResource(
"pattarns/sourcefire");
grok = Grok.create(pattern_url.getFile());
grok.compile("%{SOURCEFIRE}");
}
代码示例来源:origin: OpenSOC/opensoc-streaming
public GrokAsaParser(String filepath) throws Exception {
grok = Grok.create(filepath);
// grok.getNamedRegexCollection().put("ciscotag","CISCOFW302013_302014_302015_302016");
grok.compile("%{CISCO_TAGGED_SYSLOG}");
}
代码示例来源:origin: OpenSOC/opensoc-streaming
public GrokSourcefireParser(String filepath) throws GrokException
{
grok = Grok.create(filepath);
grok.compile("%{SOURCEFIRE}");
}
代码示例来源:origin: OpenSOC/opensoc-streaming
public GrokSourcefireParser(String filepath, String pattern) throws GrokException
{
grok = Grok.create(filepath);
grok.compile("%{"+pattern+"}");
}
代码示例来源:origin: OpenSOC/opensoc-streaming
public GrokAsaParser(String filepath, String pattern) throws Exception {
grok = Grok.create(filepath);
grok.compile("%{" + pattern + "}");
}
代码示例来源:origin: com.wavefront/proxy
private Grok grok() {
if (grok != null) return grok;
synchronized (grokLock) {
if (grok != null) return grok;
try {
grok = Grok.create(patternsFile);
grok.compile(pattern);
} catch (GrokException e) {
logger.severe("Invalid grok pattern: " + pattern);
throw Throwables.propagate(e);
}
return grok;
}
}
代码示例来源:origin: wavefrontHQ/java
private Grok grok() {
if (grok != null) return grok;
synchronized (grokLock) {
if (grok != null) return grok;
try {
grok = Grok.create(patternsFile);
grok.compile(pattern);
} catch (GrokException e) {
logger.severe("Invalid grok pattern: " + pattern);
throw Throwables.propagate(e);
}
return grok;
}
}
代码示例来源:origin: OpenSOC/opensoc-streaming
private Map<String, Grok> getGrokMap() throws GrokException, IOException {
Map<String, Grok> map = new HashMap<String, Grok>();
for (Map.Entry<String, String> entry : patternMap.entrySet()) {
File file = stream2file(pattern_url);
Grok grok = Grok.create(file.getPath());
grok.compile("%{" + entry.getValue() + "}");
map.put(entry.getValue(), grok);
}
return map;
}
代码示例来源:origin: OpenSOC/opensoc-streaming
public GrokAsaParser() throws Exception {
// pattern_url = Resources.getResource("patterns/asa");
pattern_url = getClass().getClassLoader().getResourceAsStream(
"patterns/asa");
File file = stream2file(pattern_url);
grok = Grok.create(file.getPath());
patternMap = getPatternMap();
grokMap = getGrokMap();
grok.compile("%{CISCO_TAGGED_SYSLOG}");
}
代码示例来源:origin: OpenSOC/opensoc-streaming
grok = Grok.create(file.getPath());
} catch (GrokException e) {
代码示例来源:origin: com.tomitribe.tribestream/tribestream-container
public GrokUtil(String grokPattern, String grokPatternsFile) {
if (grokPattern == null || grokPattern.trim().isEmpty()) {
throw new IllegalArgumentException("Grok Pattern can't be null nor empty.");
}
LOGGER.info(ContainerCodes.GROK_PATTERN_SET, "Grok pattern set to {0}. Compiling ...", grokPattern);
try {
if (grokPatternsFile == null) {
grokPatternsFile = SystemInstance.get().getConf("patterns").getAbsolutePath();
LOGGER.info(ContainerCodes.GROK_PATTERN_NOT_SET, "Pattern file not set. Setting to {0}", grokPatternsFile);
}
grok = Grok.create(grokPatternsFile);
grok.compile(grokPattern);
LOGGER.info(ContainerCodes.GROK_COMPILED, "Grok pattern {0} successfully compiled.", grokPattern);
} catch (final GrokException e) {
LOGGER.warning(ContainerCodes.GROK_CANT_COMPILE, "Can't compile Grok pattern {0}. Error is {1}. Skipping ...",
grokPattern, e.getMessage());
throw new RuntimeException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!