Пример #1
0
  @Override
  public LogData parse(String line, ParsingContext parsingContext) throws ParseException {

    final StringBuilder unmatchedLog = parsingContext.getUnmatchedLog();
    if (unmatchedLog.length() == 0 && !line.startsWith("{")) {
      return null;
    }

    unmatchedLog.append(line).append("\n");
    final Optional<LogData> logData =
        jsonExtractor.parseJsonLog(unmatchedLog.toString(), parsingContext.getDateFormat());
    if (logData.isPresent()) {
      unmatchedLog.setLength(0);
      return logData.get();
    }
    return null;
  }
Пример #2
0
 @Override
 public void initParsingContext(ParsingContext parsingContext) {
   parsingContext.setDateFormat(jsonExtractor.createDateFormatter());
 }