Exemple #1
0
 // Token: 0x06000073 RID: 115 RVA: 0x000044D4 File Offset: 0x000026D4
 public LogFileInfo(string fullName, long length, DateTime startTime, CsvTable csvTable, bool isActive)
 {
     ExTraceGlobals.ServiceTracer.TraceDebug <string, long, string>((long)this.GetHashCode(), "MsExchangeLogSearch constructs LogFileInfo with FilePath {0}, FileLength {1}, FileCreateTime {2}", fullName, length, startTime.ToString());
     this.fullName       = fullName.ToLower();
     this.length         = length;
     this.startTime      = startTime;
     this.prefix         = LogMonitor.GetFullPrefix(this.fullName);
     this.csvTable       = csvTable;
     this.isActive       = isActive;
     this.needsTimeCheck = true;
     if (LogFileInfo.LogFileOpened != null)
     {
         LogFileInfo.LogFileOpened(new LogFile(this), null);
     }
 }
Exemple #2
0
        // Token: 0x060000BA RID: 186 RVA: 0x000064F8 File Offset: 0x000046F8
        private void InsertByPrefix(LogFileInfo logFileInfo, Dictionary <string, List <LogFileInfo> > listsByPrefix, IComparer <LogFileInfo> comparer)
        {
            List <LogFileInfo> list;

            if (!listsByPrefix.TryGetValue(logFileInfo.Prefix, out list))
            {
                list = new List <LogFileInfo>();
                listsByPrefix[logFileInfo.Prefix] = list;
            }
            int num = list.BinarySearch(logFileInfo, comparer);

            if (num < 0)
            {
                num = ~num;
            }
            list.Insert(num, logFileInfo);
        }
Exemple #3
0
        // Token: 0x06000081 RID: 129 RVA: 0x00004C3C File Offset: 0x00002E3C
        private RegistryKey OpenWatermarkKey(bool createIfMissing)
        {
            RegistryKey result;

            using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\ExchangeServer\\v15\\Transport", createIfMissing))
            {
                if (registryKey == null)
                {
                    ExTraceGlobals.ServiceTracer.TraceError <string>((long)this.GetHashCode(), "Cannot open: {0}", "SOFTWARE\\Microsoft\\ExchangeServer\\v15\\Transport");
                    result = null;
                }
                else
                {
                    using (RegistryKey registryKey2 = LogFileInfo.OpenSubKey(registryKey, "LogSearch", createIfMissing))
                    {
                        if (registryKey2 == null)
                        {
                            ExTraceGlobals.ServiceTracer.TraceDebug <RegistryKey, string>((long)this.GetHashCode(), "Cannot open: {0}\\{1}", registryKey, "LogSearch");
                            result = null;
                        }
                        else
                        {
                            RegistryKey registryKey3 = LogFileInfo.OpenSubKey(registryKey2, "Watermark", createIfMissing);
                            if (registryKey3 == null)
                            {
                                ExTraceGlobals.ServiceTracer.TraceDebug <RegistryKey, string>((long)this.GetHashCode(), "Cannot open {0}\\{1}", registryKey2, "Watermark");
                                result = null;
                            }
                            else
                            {
                                ExTraceGlobals.ServiceTracer.TraceDebug <RegistryKey>((long)this.GetHashCode(), "Opened {0}", registryKey3);
                                result = registryKey3;
                            }
                        }
                    }
                }
            }
            return(result);
        }
Exemple #4
0
        // Token: 0x060000B3 RID: 179 RVA: 0x00005AD4 File Offset: 0x00003CD4
        public List <LogFileInfo> GetFileInfoForTimeRange(DateTime start, DateTime end)
        {
            ExTraceGlobals.ServiceTracer.TraceDebug <string, string>((long)this.GetHashCode(), "MsExchangeLogSearch LogMoniter GetFileInfoFortimeRange with start time {0} and end time {1}", start.ToString(), end.ToString());
            List <LogFileInfo> list  = new List <LogFileInfo>();
            LogFileInfo        item  = new LogFileInfo(start);
            LogFileInfo        item2 = new LogFileInfo(end);

            try
            {
                this.fileListLock.EnterReadLock();
                foreach (List <LogFileInfo> list2 in this.filesByDate.Values)
                {
                    int num  = list2.BinarySearch(item, LogMonitor.ByDateComparer.Default);
                    int num2 = list2.BinarySearch(item2, LogMonitor.ByDateComparer.Default);
                    if (num < 0)
                    {
                        num = ~num;
                        if (num > 0)
                        {
                            num--;
                        }
                    }
                    if (num2 < 0)
                    {
                        num2 = ~num2;
                    }
                    for (int i = num; i < num2; i++)
                    {
                        list.Add(list2[i]);
                    }
                }
            }
            finally
            {
                this.fileListLock.ExitReadLock();
            }
            return(list);
        }
 // Token: 0x0600008F RID: 143 RVA: 0x00004DD6 File Offset: 0x00002FD6
 public LogFile(LogFileInfo logFileInfo)
 {
     this.logFileInfo = logFileInfo;
 }
Exemple #6
0
        // Token: 0x060000B9 RID: 185 RVA: 0x000062B4 File Offset: 0x000044B4
        private void ProcessNewFiles(Dictionary <string, List <FileInfo> > dirFilesByPrefix)
        {
            List <LogFileInfo> list = new List <LogFileInfo>();

            try
            {
                this.fileListLock.EnterReadLock();
                foreach (string key in dirFilesByPrefix.Keys)
                {
                    List <FileInfo>    list2 = dirFilesByPrefix[key];
                    List <LogFileInfo> list3 = null;
                    if (!this.filesByName.TryGetValue(key, out list3))
                    {
                        list3 = new List <LogFileInfo>();
                    }
                    for (int i = 0; i < list2.Count; i++)
                    {
                        try
                        {
                            FileInfo fileInfo = list2[i];
                            int      num      = list3.BinarySearch(new LogFileInfo(fileInfo.FullName), LogMonitor.ByNameComparer.Default);
                            bool     flag     = i == list2.Count - 1;
                            if (num < 0)
                            {
                                LogFileInfo logFileInfo = new LogFileInfo(fileInfo.FullName, fileInfo.Length, fileInfo.CreationTimeUtc, this.csvTable, flag);
                                if (!logFileInfo.TryProcessFile())
                                {
                                    ExTraceGlobals.ServiceTracer.TraceError((long)this.GetHashCode(), "Failed to process file due to I/O error, not processing file now");
                                    return;
                                }
                                list.Add(logFileInfo);
                            }
                            else
                            {
                                list3[num].MarkInactiveIfNeeded(flag);
                            }
                        }
                        catch (FileNotFoundException arg)
                        {
                            ExTraceGlobals.ServiceTracer.TraceDebug <FileNotFoundException>((long)this.GetHashCode(), "Encountered deleted file {0}.", arg);
                        }
                    }
                }
            }
            finally
            {
                this.fileListLock.ExitReadLock();
            }
            if (list.Count != 0)
            {
                try
                {
                    this.fileListLock.EnterWriteLock();
                    foreach (LogFileInfo logFileInfo2 in list)
                    {
                        this.InsertByPrefix(logFileInfo2, this.filesByDate, LogMonitor.ByDateComparer.Default);
                        this.InsertByPrefix(logFileInfo2, this.filesByName, LogMonitor.ByNameComparer.Default);
                    }
                }
                finally
                {
                    this.fileListLock.ExitWriteLock();
                }
                return;
            }
        }
 // Token: 0x0600016F RID: 367 RVA: 0x00009F88 File Offset: 0x00008188
 private static void ProcessRow(object sender, ProcessRowEventArgs args)
 {
     if (EHALogSearchComponent.agentLogMonitorStarted)
     {
         LogFileInfo logFileInfo = sender as LogFileInfo;
         if (logFileInfo != null)
         {
             try
             {
                 string field         = args.Row.GetField <string>(EHALogSearchComponent.journalResponseColumnIndex);
                 string strB          = EHALogSearchComponent.RegexMatch(EHALogSearchComponent.JournalStatusParser.RxSTATUS, field).ToLower();
                 string senderAddress = EHALogSearchComponent.RegexMatch(EHALogSearchComponent.JournalStatusParser.RxSND, field);
                 if (string.Compare(EHALogSearchComponent.Configuration.UnwrapProcessSuccess, strB, StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(EHALogSearchComponent.Configuration.NDRProcessSuccess, strB, StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(EHALogSearchComponent.Configuration.AlreadyProcessed, strB, StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(EHALogSearchComponent.Configuration.PermanentError, strB, StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(EHALogSearchComponent.Configuration.NoUsersResolved, strB, StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(EHALogSearchComponent.Configuration.DropJournalReportWithoutNdr, strB, StringComparison.OrdinalIgnoreCase) == 0)
                 {
                     uint   num              = EHALogSearchComponent.Convert(EHALogSearchComponent.RegexMatch(EHALogSearchComponent.JournalStatusParser.RxRBS, field));
                     uint   num2             = EHALogSearchComponent.Convert(EHALogSearchComponent.RegexMatch(EHALogSearchComponent.JournalStatusParser.RxRTO, field));
                     string text             = EHALogSearchComponent.RegexMatch(EHALogSearchComponent.JournalStatusParser.RxRID, field);
                     string recipientAddress = EHALogSearchComponent.RegexMatch(EHALogSearchComponent.JournalStatusParser.RxRCP, field);
                     string text2            = EHALogSearchComponent.RegexMatch(EHALogSearchComponent.JournalStatusParser.RxExtOrgId, field);
                     Guid   empty            = Guid.Empty;
                     if (!Guid.TryParse(text2, out empty))
                     {
                         throw new FormatException(string.Format(CultureInfo.InvariantCulture, "The value '{0}' of ExtOrgId segment is not in a recognized Guid format", new object[]
                         {
                             text2
                         }));
                     }
                     if (empty == Guid.Empty)
                     {
                         throw new FormatException(string.Format(CultureInfo.InvariantCulture, "The value '{0}' of ExtOrgId segment is Empty and it cannot be used for tenant attribution.", new object[]
                         {
                             text2
                         }));
                     }
                     Microsoft.Exchange.HostedServices.Archive.MetaReplication.ReplicationStatus defectiveStatus = EHALogSearchComponent.GetDefectiveStatus(field);
                     if (0 < text.Length && 0U < num && 0U < num2)
                     {
                         EHALogSearchComponent.AddMessageCheckSend(senderAddress, recipientAddress, text, empty, num, num2, defectiveStatus);
                     }
                 }
             }
             catch (FormatException ex)
             {
                 EHALogSearchComponent.logger.LogEvent(MSExchangeTransportLogSearchEventLogConstants.Tuple_TransportSyncLogEntryProcessingFailure, DateTime.UtcNow.Hour.ToString(), new object[]
                 {
                     ex
                 });
             }
             catch (ArgumentException ex2)
             {
                 EHALogSearchComponent.logger.LogEvent(MSExchangeTransportLogSearchEventLogConstants.Tuple_TransportSyncLogEntryProcessingFailure, DateTime.UtcNow.Hour.ToString(), new object[]
                 {
                     ex2
                 });
             }
             catch (NullReferenceException ex3)
             {
                 EHALogSearchComponent.logger.LogEvent(MSExchangeTransportLogSearchEventLogConstants.Tuple_TransportSyncLogEntryProcessingFailure, DateTime.UtcNow.Hour.ToString(), new object[]
                 {
                     ex3
                 });
             }
         }
     }
 }