private void ProcessCppLine(LogLine logLine) { if (!(logLine.LineContents is NativeJsonLogsBaseEvent baseEvent)) { _processingNotificationsCollector.ReportError($"Was not able to cast line contents as {nameof(NativeJsonLogsBaseEvent)}", logLine, nameof(DataServerPlugin)); return; } if (baseEvent.EventPayload == null) { _processingNotificationsCollector.ReportError("Log line does not contain event payload (\"v\" key in json). Skipping this line", logLine, nameof(DataServerPlugin)); return; } if (ShouldSkip(baseEvent)) { return; } try { var @event = new DataServerEvent(logLine, baseEvent); _writer.AddLine(@event); } catch (JsonException ex) { var message = $"Exception occurred while parsing log line. Most likely - something is wrong with JSON format. Event type: `{baseEvent?.EventType ?? "(null)"}`. Exception message: `{ex.Message}`"; _processingNotificationsCollector.ReportError(message, logLine, nameof(DataServerPlugin)); } }
private void ProcessJavaLine(LogLine logLine) { var javaLineMatchResult = logLine.LineContents.MatchJavaLineWithSessionInfo(SharedRegex.JavaLogLineRegex); if (!javaLineMatchResult.SuccessfulMatch) { _processingNotificationsCollector.ReportError("Failed to parse Data Server Java event from log line", logLine, nameof(DataServerPlugin)); return; } var @event = new DataServerEvent(logLine, javaLineMatchResult); _writer.AddLine(@event); }
private void ProcessCppLine(LogLine logLine) { if (!(logLine.LineContents is NativeJsonLogsBaseEvent baseEvent)) { _processingNotificationsCollector.ReportError($"Was not able to cast line contents as {nameof(NativeJsonLogsBaseEvent)}", logLine, nameof(DataServerPlugin)); return; } if (baseEvent.EventPayload == null) { _processingNotificationsCollector.ReportError("Log line does not contain event payload (\"v\" key in json). Skipping this line", logLine, nameof(DataServerPlugin)); return; } if (ShouldSkip(baseEvent)) { return; } var @event = new DataServerEvent(logLine, baseEvent); _writer.AddLine(@event); }
private void ProcessJavaLine(LogLine logLine) { var match = logLine.LineContents.CastToStringAndRegexMatch(SharedRegex.JavaLogLineRegex); if (match == null || !match.Success) { _processingNotificationsCollector.ReportError("Failed to parse Data Server Java event from log line", logLine, nameof(DataServerPlugin)); return; } var @event = new DataServerEvent( logLine, TimestampParsers.ParseJavaLogsTimestamp(match.GetString("ts")), match.GetString("class"), match.GetNullableString("req"), match.GetNullableString("sess"), match.GetString("sev"), match.GetNullableString("site"), match.GetString("thread"), match.GetNullableString("user"), match.GetString("message")); _writer.AddLine(@event); }