Exemplo n.º 1
0
        private bool UpdateInternalLogEntryIndex(LogEvent logEntry, LogInfoEntry logInfoEntry)
        {
// If an event of given Id already arrived - calculate the duration and enqueue for further processing.
            lock (logInfoEntry)
            {
                // This condition ensures that the log still exists (it wasn't removed by concurrent task)
                if (!eventInfoDict.TryGetValue(logEntry.Id, out _))
                {
                    return(false);
                }

                var duration = Math.Abs(logEntry.TimeStamp - eventInfoDict[logEntry.Id].Start);
                Log.Debug("Found matching event: {logEntry}", logEntry);

                Events.Enqueue(new LogEventInfo
                {
                    Duration = duration,
                    Id       = logEntry.Id,
                    Host     = logEntry.Host,
                    Type     = logEntry.Type,
                    Alert    = duration > minDurationForFlagging
                });

                eventInfoDict.TryRemove(logEntry.Id, out _);

                return(true);
            }
        }
Exemplo n.º 2
0
 public LogEntryViewModel(LogInfoEntry logEntry)
 {
     Message   = logEntry.Message;
     Timestamp = logEntry.Timestamp;
     LogLevel  = logEntry.Level;
 }