예제 #1
0
        public bool FindLog(DateTime timestamp, bool createIfNotExists, out IAuditLog auditLog)
        {
            auditLog = null;
            DateTime     dateTime;
            DateTime     dateTime2;
            string       logFolderNameAndRange = AuditLogCollection.GetLogFolderNameAndRange(timestamp, out dateTime, out dateTime2);
            FolderIdType folderIdType          = null;

            if (!this.ewsClient.FindFolder(logFolderNameAndRange, this.auditRootFolderId, out folderIdType))
            {
                if (!createIfNotExists)
                {
                    if (this.IsTraceEnabled(TraceType.DebugTrace))
                    {
                        this.Tracer.TraceDebug <DateTime>((long)this.GetHashCode(), "No matching log subfolder found. Lookup time={0}", timestamp);
                    }
                    return(false);
                }
                bool flag = this.ewsClient.CreateFolder(logFolderNameAndRange, this.auditRootFolderId, out folderIdType);
                if (!flag)
                {
                    flag = this.ewsClient.FindFolder(logFolderNameAndRange, this.auditRootFolderId, out folderIdType);
                }
                if (!flag && this.IsTraceEnabled(TraceType.DebugTrace))
                {
                    this.Tracer.TraceDebug <DateTime, DateTime>((long)this.GetHashCode(), "Failed to create audit log folder for log range [{0}, {1})", dateTime, dateTime2);
                }
            }
            if (folderIdType != null)
            {
                auditLog = new EwsAuditLog(this.ewsClient, folderIdType, dateTime, dateTime2);
            }
            return(folderIdType != null);
        }
예제 #2
0
        public IEnumerable <IAuditLog> GetAuditLogs()
        {
            BaseFolderType[] subfolders = this.ewsClient.GetSubFolders(this.auditRootFolderId, null);
            foreach (BaseFolderType subfolder in subfolders)
            {
                DateTime logRangeStart;
                DateTime logRangeEnd;
                bool     validLogSubfolder = AuditLogCollection.TryParseLogRange(subfolder.DisplayName, out logRangeStart, out logRangeEnd);
                if (validLogSubfolder && subfolder.TotalCount > 0)
                {
                    yield return(new EwsAuditLog(this.ewsClient, subfolder.FolderId, logRangeStart, logRangeEnd));
                }
            }
            yield return(new EwsAuditLog(this.ewsClient, this.auditRootFolderId, DateTime.MinValue, DateTime.MaxValue));

            yield break;
        }
예제 #3
0
        // Token: 0x06000666 RID: 1638 RVA: 0x00030BD8 File Offset: 0x0002EDD8
        private bool ProcessFolderContents(DefaultFolderType folderToCollect, ItemQueryType itemQueryType)
        {
            if (AuditQuotaEnforcer.Tracer.IsTraceEnabled(TraceType.DebugTrace))
            {
                AuditQuotaEnforcer.Tracer.TraceDebug <AuditQuotaEnforcer, DefaultFolderType, ItemQueryType>((long)this.GetHashCode(), "{0}: ProcessFolderContents: folderToCollect={1}, itemQueryType={2}.", this, folderToCollect, itemQueryType);
            }
            StoreId            adminAuditLogsFolderId = base.MailboxDataForTags.MailboxSession.GetAdminAuditLogsFolderId();
            int                num = 0;
            AuditLogCollection auditLogCollection = new AuditLogCollection(base.MailboxDataForTags.MailboxSession, adminAuditLogsFolderId, AuditQuotaEnforcer.Tracer);

            foreach (IAuditLog auditLog in auditLogCollection.GetAuditLogs())
            {
                AuditLog auditLog2 = (AuditLog)auditLog;
                this.itemsInDumpster += auditLog2.EstimatedItemCount;
                foreach (ItemData itemData in auditLog2.FindAuditRecords <ItemData>(this))
                {
                    base.TagExpirationExecutor.AddToDoomedHardDeleteList(itemData, false);
                    this.deletedItemsSize += (ulong)((long)itemData.MessageSize);
                    this.itemsExpired++;
                    num++;
                    if (num % 100 == 0)
                    {
                        base.SysCleanupSubAssistant.ThrottleStoreCallAndCheckForShutdown(base.MailboxDataForTags.MailboxSession.MailboxOwner);
                    }
                }
                if (this.dumpsterSize - this.deletedItemsSize <= this.dumpsterQuota.Value.ToBytes())
                {
                    if (AuditQuotaEnforcer.Tracer.IsTraceEnabled(TraceType.DebugTrace))
                    {
                        AuditQuotaEnforcer.Tracer.TraceDebug <AuditQuotaEnforcer, ulong, ulong>((long)this.GetHashCode(), "{0}: Collected sufficient items. dumspterSize={1}, deletedItemsSize={2}.", this, this.dumpsterSize, this.deletedItemsSize);
                        break;
                    }
                    break;
                }
            }
            return(true);
        }
 // Token: 0x06000644 RID: 1604 RVA: 0x00030114 File Offset: 0x0002E314
 protected override void CollectItemsToExpire()
 {
     AuditFolderStrategy[] array = new AuditFolderStrategy[]
     {
         new MailboxAuditFolderStrategy(base.MailboxDataForTags, AuditExpirationEnforcer.Tracer),
         new AdminAuditFolderStrategy(base.MailboxDataForTags, AuditExpirationEnforcer.Tracer)
     };
     foreach (AuditFolderStrategy auditFolderStrategy in array)
     {
         StoreId folderId = auditFolderStrategy.GetFolderId(base.MailboxDataForTags.MailboxSession);
         if (folderId != null)
         {
             EnhancedTimeSpan auditRecordAgeLimit = auditFolderStrategy.AuditRecordAgeLimit;
             if (auditFolderStrategy is AdminAuditFolderStrategy)
             {
                 using (Folder folder = Folder.Bind(base.MailboxDataForTags.MailboxSession, folderId, new PropertyDefinition[]
                 {
                     FolderSchema.ExtendedSize
                 }))
                 {
                     this.CheckAndLogAdminAuditsWarningQuota(folder);
                 }
                 base.MailboxDataForTags.StatisticsLogEntry.AdminAuditRecordAgeLimit = auditRecordAgeLimit.ToString();
                 base.MailboxDataForTags.StatisticsLogEntry.IsAdminAuditLog          = true;
             }
             else
             {
                 base.MailboxDataForTags.StatisticsLogEntry.MailboxAuditRecordAgeLimit = auditRecordAgeLimit.ToString();
             }
             AuditLogCollection auditLogCollection = new AuditLogCollection(base.MailboxDataForTags.MailboxSession, folderId, AuditExpirationEnforcer.Tracer);
             this.expirationTime = DateTime.MinValue;
             if (ElcGlobals.ExpireDumpsterRightNow)
             {
                 this.expirationTime = DateTime.MaxValue;
             }
             else if (auditRecordAgeLimit != EnhancedTimeSpan.MaxValue)
             {
                 this.expirationTime = base.MailboxDataForTags.UtcNow.Subtract(auditRecordAgeLimit);
             }
             if (this.expirationTime != DateTime.MinValue)
             {
                 List <VersionedId> list = new List <VersionedId>();
                 int num = 0;
                 foreach (AuditLog auditLog in auditLogCollection.GetExpiringAuditLogs(this.expirationTime))
                 {
                     foreach (ItemData itemData in auditLog.FindAuditRecords <ItemData>(this))
                     {
                         base.TagExpirationExecutor.AddToDoomedHardDeleteList(itemData, false);
                         this.itemsExpired++;
                         num++;
                         if (num % 100 == 0)
                         {
                             base.SysCleanupSubAssistant.ThrottleStoreCallAndCheckForShutdown(base.MailboxDataForTags.MailboxSession.MailboxOwner);
                         }
                     }
                     if (auditLog.EstimatedLogEndTime < this.expirationTime && auditLog.LogFolderId is VersionedId)
                     {
                         list.Add(auditLog.LogFolderId as VersionedId);
                     }
                 }
                 if (list.Count > 0)
                 {
                     foreach (VersionedId itemId in list)
                     {
                         base.TagExpirationExecutor.AddToDoomedHardDeleteList(new ItemData(itemId, 0), false);
                     }
                 }
             }
         }
     }
 }