Пример #1
0
 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);
 }
Пример #2
0
        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));
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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);
        }
Пример #6
0
 protected abstract void ProcessRowData(ParsedReadOnlyRow rowData);
Пример #7
0
 protected abstract bool ShouldProcessLogLine(ParsedReadOnlyRow parsedRow);
Пример #8
0
 internal abstract bool ContainsMessage(ParsedReadOnlyRow parsedRow);
Пример #9
0
        protected override bool ShouldProcessLogLine(ParsedReadOnlyRow parsedRow)
        {
            object field = parsedRow.UnParsedRow.GetField <object>(3);

            return(field != null);
        }