public bool LineReceived(ReadOnlyRow row) { ArgumentValidator.ThrowIfNull("row", row); try { ParsedReadOnlyRow parsedReadOnlyRow = new ParsedReadOnlyRow(row); if (this.ShouldProcessLogLine(parsedReadOnlyRow)) { this.ProcessRowData(parsedReadOnlyRow); this.numOfBytesRead += row.EndPosition - row.Position; this.numberOfLinesInBatch++; } } catch (InvalidLogLineException exception) { this.LogErrorAndUpdatePerfCounter(row.Position, row.EndPosition, exception, LogUploaderEventLogConstants.Tuple_LogLineParseError, (LogUploaderEventLogConstants.Message) 3221230473U, "InvalidLogLineInParse"); } catch (InvalidPropertyValueException exception2) { this.LogErrorAndUpdatePerfCounter(row.Position, row.EndPosition, exception2, LogUploaderEventLogConstants.Tuple_InvalidPropertyValueInParse, (LogUploaderEventLogConstants.Message) 3221230481U, "InvalidPropertyValueInParse"); } catch (MissingPropertyException exception3) { this.LogErrorAndUpdatePerfCounter(row.Position, row.EndPosition, exception3, LogUploaderEventLogConstants.Tuple_MissingPropertyInParse, (LogUploaderEventLogConstants.Message) 3221230480U, "MissingPropertyInParse"); } catch (InvalidCastException exception4) { this.LogErrorAndUpdatePerfCounter(row.Position, row.EndPosition, exception4, LogUploaderEventLogConstants.Tuple_InvalidCastInParse, (LogUploaderEventLogConstants.Message) 3221230482U, "InvalidCastInParse"); } catch (FailedToRetrieveRegionTagException) { return(false); } return(true); }
public object GetField(string fieldName, Type targetType) { object obj; if (this.parsedRow.ContainsKey(fieldName)) { obj = this.parsedRow[fieldName]; } else { Type fieldType; if (!this.unparsedRow.Schema.TryGetTypeByName(fieldName, out fieldType)) { throw new InvalidLogLineException(Strings.UnknownField(fieldName)); } obj = this.ParseField(fieldName, fieldType); } return(ParsedReadOnlyRow.ConvertToTargetObjectType(fieldName, obj, targetType)); }
private void MsgtrkLineReceivedHelper(ReadOnlyRow row) { bool flag = false; try { ParsedReadOnlyRow parsedReadOnlyRow = new ParsedReadOnlyRow(row); this.newestLogLineTS = parsedReadOnlyRow.GetField <DateTime>("date-time"); if (this.TryBackfillBufferedMessage(parsedReadOnlyRow)) { this.activeBatch.StartNewRangeForActiveBatch(row.EndPosition); } else { flag = this.activeBatch.LineReceived(row); } } catch (InvalidLogLineException exception) { this.activeBatch.LogErrorAndUpdatePerfCounter(row.Position, row.EndPosition, exception, LogUploaderEventLogConstants.Tuple_LogLineParseError, (LogUploaderEventLogConstants.Message) 3221230473U, "InvalidLogLineInParse"); flag = true; } catch (InvalidPropertyValueException exception2) { this.activeBatch.LogErrorAndUpdatePerfCounter(row.Position, row.EndPosition, exception2, LogUploaderEventLogConstants.Tuple_InvalidPropertyValueInParse, (LogUploaderEventLogConstants.Message) 3221230481U, "InvalidPropertyValueInParse"); flag = true; } catch (MissingPropertyException exception3) { this.activeBatch.LogErrorAndUpdatePerfCounter(row.Position, row.EndPosition, exception3, LogUploaderEventLogConstants.Tuple_MissingPropertyInParse, (LogUploaderEventLogConstants.Message) 3221230480U, "MissingPropertyInParse"); flag = true; } catch (InvalidCastException exception4) { this.activeBatch.LogErrorAndUpdatePerfCounter(row.Position, row.EndPosition, exception4, LogUploaderEventLogConstants.Tuple_InvalidCastInParse, (LogUploaderEventLogConstants.Message) 3221230482U, "InvalidCastInParse"); flag = true; } if (flag) { this.activeBatch.UpdateCurrentRangeOffsets(row.Position, row.EndPosition); } }
protected override void ProcessRowData(ParsedReadOnlyRow rowData) { ReadOnlyRow unParsedRow = rowData.UnParsedRow; AuditLogRecordType field = unParsedRow.GetField <AuditLogRecordType>(3); string field2 = unParsedRow.GetField <string>(4); AuditRecord auditRecord = this.RecordSerializer.Read <AuditRecord>(field2, field); switch (AuditUploaderConfig.GetAction(auditRecord.RecordType.ToString(), auditRecord.OrganizationName, auditRecord.UserId, auditRecord.Operation)) { case Actions.LetThrough: this.records.Add(auditRecord); break; case Actions.Skip: case Actions.SkipAndLogEvent: break; default: return; } }
private bool TryBackfillBufferedMessage(ParsedReadOnlyRow parsedRow) { if (!this.shouldBufferBatches) { return(false); } ReadOnlyRow unParsedRow = parsedRow.UnParsedRow; foreach (T t in this.messageBatchBuffer) { MessageBatchBase messageBatchBase = t as MessageBatchBase; Tools.DebugAssert(messageBatchBase != null, "Failed cast to MessageBatchBase."); if (!messageBatchBase.ReachedDalOptimizationLimit() && messageBatchBase.ContainsMessage(parsedRow)) { if (messageBatchBase.LineReceived(unParsedRow)) { messageBatchBase.AddRangeToBufferedBatch(unParsedRow.Position, unParsedRow.EndPosition); } this.newBackfilledLogLines += 1L; return(true); } } return(false); }
protected abstract void ProcessRowData(ParsedReadOnlyRow rowData);
protected abstract bool ShouldProcessLogLine(ParsedReadOnlyRow parsedRow);
internal abstract bool ContainsMessage(ParsedReadOnlyRow parsedRow);
protected override bool ShouldProcessLogLine(ParsedReadOnlyRow parsedRow) { object field = parsedRow.UnParsedRow.GetField <object>(3); return(field != null); }