本文整理了Java中io.krakens.grok.api.Grok.getOriginalGrokPattern()
方法的一些代码示例,展示了Grok.getOriginalGrokPattern()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Grok.getOriginalGrokPattern()
方法的具体详情如下:
包路径:io.krakens.grok.api.Grok
类名称:Grok
方法名:getOriginalGrokPattern
[英]Original grok pattern used to compile to the named regex.
[中]用于编译为命名正则表达式的原始grok模式。
代码示例来源:origin: apache/nifi
static RecordSchema createRecordSchema(final Grok grok) {
final List<RecordField> fields = new ArrayList<>();
String grokExpression = grok.getOriginalGrokPattern();
populateSchemaFieldNames(grok, grokExpression, fields);
fields.add(new RecordField(GrokRecordReader.STACK_TRACE_COLUMN_NAME, RecordFieldType.STRING.getDataType(), true));
fields.add(new RecordField(GrokRecordReader.RAW_MESSAGE_NAME, RecordFieldType.STRING.getDataType(), true));
final RecordSchema schema = new SimpleRecordSchema(fields);
return schema;
}
代码示例来源:origin: vmware/hillview
Set<String> columnsFound = new HashSet<String>();
String currentPattern = grok.getOriginalGrokPattern();
int index = 0;
boolean continueIteration = true;
代码示例来源:origin: thekrakken/java-grok
@Test
public void test003_samePattern() throws GrokException {
String pattern = "Hello World";
Grok grok = compiler.compile(pattern);
assertEquals(pattern, grok.getOriginalGrokPattern());
}
代码示例来源:origin: vmware/hillview
LogFileLoader(final String path, @Nullable Instant start, @Nullable Instant end) {
super(path);
this.grokCompiler = GrokCompiler.newInstance();
this.grokCompiler.registerDefaultPatterns();
this.grokCompiler.registerPatternFromClasspath("/patterns/log-patterns");
this.grok = grokCompiler.compile(logFormat, true);
this.start = start;
this.end = end;
this.parsingErrors = new StringListColumn(
new ColumnDescription(parseErrorColumn, ContentsKind.String));
this.lineNumber = new IntListColumn(
new ColumnDescription(lineNumberColumn, ContentsKind.Integer));
String originalPattern = this.grok.getOriginalGrokPattern();
String timestampPattern = GrokExtra.extractGroupPattern(
this.grokCompiler.getPatternDefinitions(),
originalPattern, GenericLogs.timestampColumnName);
if (timestampPattern == null) {
HillviewLogger.instance.warn("Pattern does not contain column named 'Timestamp'",
"{0}", originalPattern);
this.dateTime = null;
} else {
this.dateTime = this.grokCompiler.compile(
"%{" + timestampPattern + ":" + GenericLogs.timestampColumnName + "}", true);
}
}
内容来源于网络,如有侵权,请联系作者删除!