return super.doProcess(outputRecord);
}
private boolean doMatch(Record inputRecord, Record outputRecord, boolean doExtract) {
for (Map.Entry<String, Matcher> regexEntry : regexes.entrySet()) {
Matcher matcher = regexEntry.getValue();
List values = inputRecord.get(regexEntry.getKey());
int todo = values.size();
int minMatches = 1;
int maxMatches = Integer.MAX_VALUE;
switch (numRequiredMatches) {
case once : {
maxMatches = 1;
break;
}
case all : {
minMatches = todo;
break;
}
default: {
break;
}
}
int numMatches = 0;
for (Object value : values) {
matcher.reset(value.toString());
if (!findSubstrings) {
if (matcher.matches()) {
numMatches++;
if (numMatches > maxMatches) {
LOG.debug("grok failed because it found too many matches for values: {} for grok command: {}",
values, renderedConfig);
return false;
}
extract(outputRecord, matcher, doExtract);
}
} else {
int previousNumMatches = numMatches;
while (matcher.find()) {
if (numMatches == previousNumMatches) {
numMatches++;
if (numMatches > maxMatches) {
LOG.debug("grok failed because it found too many matches for values: {} for grok command: {}",
values, renderedConfig);