Where did all that data come from? A funny thing happened to our Microsoft Dynamics 365. We started receiving alerts that we’d exceeded our storage limit. Our tenant was at a 154% usage.
Ouch! How did it come to this? We use Organization Insights to diagnose Microsoft Dynamics 365 storage issues.
I looked at our Organization Insights dashboard (Settings > System > Organization Insights) and found Plugin Trace Logs amount to over 1 million records. Those must be a result of a desktop app we use to get record counts of all our Dynamics 365 entities.
The Organization Insights dashboard is quite useful to review items such as users, API calls, plugin fires and failures, etc. This is information for the Microsoft Dynamics 365 tenant, not just the current instance. Organization Insights is a useful tool to fine-tune your tenant/instances. But that is another blog. We want to see the storage dashboard. Click the “Storage” icon (looks like a stack of discs) to get to the Storage Dashboard.
Then scroll down to the “Top Tables by Row Count – Current CRM Instance” chart.
The chart shows there are almost 2 million PluginTraceLogBase rows. Just a note, this image was after deleting 1.3 million rows. You may ask “What is a PluginTraceLog?” and why do we have that many?
Since it’s introduction in Dynamics CRM 2016, a system admin can enable the plugin trace logging in a Dynamics 365 instance. The plugin trace log captures Trace events from plugins and custom workflow activities. Most developers will add a trace message to their code to share information. Previously, the only way to see the trace messages where during a failure. Here is an example of a trace line in the code.
Here is a sample of part of the information in the PluginTraceLog record. The below PluginTraceLog record shows a failed job with an unhandled exception.
Again, the trace log is quite helpful in researching issues with plugins or custom workflow activities. And as before, we’re not concerned with bad plugins at this time.
How did we produce over 3 million rows of plugin trace logs?
It’s simple. At one point our instance encountered an error so we opened a ticket with Microsoft. One suggestion to track down this error was to enable the plugin trace logs. As suggested above, a plugin trace log record is created with each execution (failed or successful) of a plugin or a custom workflow activity. We have about 663 SDK messages (plugins), this does not include custom workflow activities. Most are “out of the box” solutions with a few 3rd party plugins and several of our own home built custom workflow activities like our DateFormatter, AutoNumbering etc.
When a plugin/custom workflow activity fires, the plugin trace log record is created. If we create a mailing with ClickDimensions, the plugins fire and plugin trace logs are created. One record creation could fire many plugins and with each, a plugin trace log record is created. Now if you leave it on for several months, the records easily multiply.
To solve our problem, we first deactivated the plugin trace logs (Settings > System > Administration > System Settings > Customization tab).
Now the records are not being created which means we may have a fighting chance. In the process of trying to bulk delete we encountered another error. The 3 million rows are not accessible via Advanced Find which is used when creating a bulk delete job. We’ve opened another ticket with Microsoft and will update this article when there is a resolution. In the meantime, I was able to use Kingswaysoft’s SSIS toolkit to create a delete integration job. It was either this or create a desktop application. I chose the above. Eight hours later, I’ve deleted 1.3 million records. We are now “approaching” our storage limit. WooHoo.
But there is still a long way to go. We’ll have to:
- Review the plugins to determine which are meaningful and which can be deactivated.
- Determine why they were installed and when.
- Make certain to use the plugin trace logs sparingly and to not let it run for months at a time.
- Review the next largest table to determine where can we remove records.
In other words, we’ll have to perform an analysis on our instances to see what someone on our team has installed and/or activated. If you are running into issues with PlugInTraceLogs, storage limits, or any other aspect of Dynamics 365, we can help. Contact Dyn365Pros and talk to our experts about getting your system running smoothly.
By Sanford Mosby, Microsoft Dynamics 365 Technical Consultant, Dyn365Pros, Microsoft Dynamics 365 Partner, San Diego, Southern California.