Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Size AuditBase is very big, can I shrink this?

Posted on by Microsoft Employee

Hello,

I have a little problem with our online D365.

I see in Organization Insights the the AuditBase is about 27 GB and I see that the active audit log is about 7 GB.

Is the AuditBase table something diffrent than the active audit log table?

Can I shrink this AuditBase tablke somewhere?

Kind regards,

Arie

*This post is locked for comments

  • RE: Size AuditBase is very big, can I shrink this?

    Did you ever find that "plain english" version you were seeking?  We have an issue with the table size and need some assistance as well!  thanks! Laura

  • RyanCPerry Profile Picture
    RyanCPerry 105 on at
    RE: Size AuditBase is very big, can I shrink this?

    This has me perplexed.  Like so many commenting:

    • We have deleted all but the latest "Audit Logs" via Settings>Auditing in the standard O365 Dynamics CRM UI (Version 8.2). The one remaining shows as 3.4GB.
    • Organizational Insights shows an "AuditBase" of 16.5GB. It has had plenty of time to update.
    • I borrowed from the SDK Sample Code (SDK>SampleCode>CS>DataManagement>Auditing) and connected via a console app (code is below).  While the UI shows only one Audit Log, the code retrieves 3 partitions.  With modifications to the date ranges, it would appear that any current or future audit partitions cannot be deleted, even via the SDK. The system throws an error. Two of the partitions are return a Size of 0 bytes, anyway. 

    My conclusion so far is that whoever mentioned indexing must be correct.  Has anyone found a plain english article about how exactly the auditbase size is calculated? How can one reindex it?  Does the system simply flag them for deletion and not actually delete them?  Having 16GB tied up for a 3.4GB audit log, with no apparent way to delete or reduce it is ridiculous.  If Microsoft picks up on this, some clarifying documentation would certainly help. 

    Code follows. Apologizes for lack of security or error handling. Use at your own risk. 

    using System;
    using Microsoft.Xrm.Sdk;
    using Microsoft.Crm.Sdk.Messages;
    using Microsoft.Xrm.Tooling.Connector;
    
    
    
    namespace DeleteSandboxAudit
    {
        class DeleteAuditLog
        {
            static void Main(string[] args)
            {
                string CRMConnectionString = @"AuthType = Office365; URL = xxxxxxxxxxxxxxxx.crm.dynamics.com; Username=XXXXXXXXX@XXXXXXXXX.com; Password=XXXXXXXXXXXXXXX";
    
                //Get CRM Connection
                Console.WriteLine("Connecting to Sandbox. Please Wait... ");
                CrmServiceClient crmConnection = new CrmServiceClient(CRMConnectionString);
                IOrganizationService crmService = crmConnection.OrganizationServiceProxy;
    
                Console.WriteLine("Connected to Sandbox.");
    
            
                // Get the list of audit partitions.
                Console.WriteLine("Retrieving Partions...");
                RetrieveAuditPartitionListResponse partitionRequest =
                    (RetrieveAuditPartitionListResponse)crmService.Execute(new RetrieveAuditPartitionListRequest());
                AuditPartitionDetailCollection partitions = partitionRequest.AuditPartitionDetailCollection;
    
                Console.WriteLine("Retrieved Partitions: " + partitions.Count);
    
                Console.WriteLine(partitions.ToString());
    
                // Create a delete request with an end date earlier than possible.
                DeleteAuditDataRequest deleteRequest = new DeleteAuditDataRequest();
                deleteRequest.EndDate = new DateTime(2000, 1, 1);
    
                // Check if partitions are not supported as is the case with SQL Server Standard edition.
                if (partitions.IsLogicalCollection)
                {
                    // Delete all audit records created up until now.
                    Console.WriteLine("No Partition Collection Found. Attempting Deletion of unpartitioned audit log to current date.");
                    deleteRequest.EndDate = DateTime.Now;
                }
    
                // Otherwise, delete all partitions that are older than the current partition.
                // Hint: The partitions in the collection are returned in sorted order where the 
                // partition with the oldest end date is at index 0.
                else
                {
                    for (int n = partitions.Count - 1; n >= 0; --n)
                    {
                        Console.WriteLine("Partition " + n.ToString() + " EndDate:" + partitions[n].EndDate.ToString());
                        if (partitions[n].EndDate <= DateTime.Now && partitions[n].EndDate > deleteRequest.EndDate)
                        {
                            Console.WriteLine("Setting deleteRequest.endDate to Partition " + n.ToString() + " :" + partitions[n].EndDate.ToString() + " Size(b):" + partitions[n].Size.ToString());
                            deleteRequest.EndDate = (DateTime)partitions[n].EndDate;
                            break;
                        }
                    }
    
    
                    // Delete the audit records.
                    Console.WriteLine("Attempting Deletion");
                    try
                    {
                        Console.WriteLine("deleteRequest.endDate:" + deleteRequest.EndDate.ToString());
                        if (deleteRequest.EndDate != new DateTime(2000, 1, 1))
                        {
                            crmService.Execute(deleteRequest);
                            Console.WriteLine("Audit records have been deleted.");
                        }
                        else
                            Console.WriteLine("There were no audit records that could be deleted.");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Unable to delete partitions. Exception:\n" + ex);
                    }
    
                    Console.ReadLine();
                }
    
            }
        }
    }
    


  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Size AuditBase is very big, can I shrink this?

    I think I have found the reason why the AuditBase is so big.

    We got from MS a view of our comsumption and indeed, the AufditBase is at the moment about 31 GB, 10 GB is data (and which we probably see in our Audit logs) and 21 GB of index files for that AuditBase log.

    So we see in Organization Insights the total of these two files and in the Audit log files we see only the data file.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Size AuditBase is very big, can I shrink this?

    Hi Arie, Yes you can delete the oldest logs as well.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Size AuditBase is very big, can I shrink this?

    Hi James,

    Thx a lot for the info, I will digg into this .......... ;-)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Size AuditBase is very big, can I shrink this?

    Hi Arie

    I got the detailed report via our Support Partner.

    I have been given this link for Dynamics 365 support in the past: https://www.microsoft.com/en-gb/dynamics365/contact-us, but it looks to be more sales focused (I never used it in the end). I also have 0800 032 6417 as a phone number (in the UK).

    Good luck getting the information.
    James

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Size AuditBase is very big, can I shrink this?

    Hi James,

    Tnx for the detailed info, it looks like what we have experience over the past year. We have growed also some extra GB's overnight and a few days later we were also back to 'normal'.

    We don't use the storage for Mail or Notes so that isn't the case here.

    I also agree we get every day a warning e-mail about our GB comsumption but we would rather have a detailed overview so we can see where our data is going to.

    Do you know where I can ask MS for a detailed list of all our tables?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Size AuditBase is very big, can I shrink this?

    I should also mention that when I have looked at the detailed storage reports, there is often quite a bit of storage taken up in reserve, but 17GB seems excessive!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Size AuditBase is very big, can I shrink this?

    Hi Arie

    Unfortunately, I am finding this happens more and more often. The tables seem to get bloated and take up more room than they should. This might not be happening in your situation, but it has happened to me several times. A couple of weeks ago I noticed 6GB of data was consumed overnight. I did all my usual checks and nothing seemed to explain why it had grown so quickly. It continued to grow over the next few days (over 10 GB bigger than it started) and I eventually gave in and purchased more storage. Within 24 hours, the overall storage being consumed had shrunk back down to where I would expect it to be (so I removed some of the extra storage I purchased!). This also happened the last time it unexpectedly grew.

    I asked our MS Partner if we could request for the tables to be reindexed, but they said it was an automated process controlled by MS and the MS Support guys didn't know much about the details, just that it ran more regularly for bigger databases (we are just over 100GB). Microsoft can provide a detailed list of all the tables upon request, and this might give a better indication of where storage is being consumed (Notes & Email attachments are usually to blame!).

    It is quite frustrating that we have such little control over this and the automated 80% warning emails push you to purchase more storage, but I guess that is what we have to cope with for the convenience of being in the cloud.

    James

  • Verified answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Size AuditBase is very big, can I shrink this?

    Yes, it looks inconsistent. Still, it depends on what is counted where.. I don't know how exactly those numbers are calculated on both sides. For example, I'm wondering if index size is included into those 5 numbers you posted (and it might be included into the 27GB)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans