web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Audit Log Management: unexpected error when viewing audit log management

(0) ShareShare
ReportReport
Posted on by 1,815

On Dynamics CRM 2013 SP1 UR1 on-prem:

When I go to Settings/Auditing/Audit Log Management, I get an unexpected error instead of the list of log partitions.

The eventlog on the server tells me that ...AuditService.RetrieveAuditPartitionList() fails with InvalidCastException: Specified cast is not valid.

Everything else regarding audit (summary, details on a record itself) works fine.

Any idea how I get "Audit Log Management" to work?

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hey Peter,

    did you manage to solve this problem?

  • Suggested answer
    Peter72 Profile Picture
    1,815 on at

    Hi, the issue disappeared magically... I assume it has something to do with how SQL Server (or CRM) maintains partitioning.

    I did a deep analysis of the issue including sql tracing and re-engineering of the respective DLL to understand what the problem is, but we did nothing for resolving it. SQL Server (or CRM) took care of the problem. We had the issue approx. 1 month, and then it disappeared and functionality worked as expected.

    What we found:

    The Statement which is executed against the database is the following. In case of SQL Server Enterprise, the first Select-Statement is used.

    IF (CONVERT(int, (SELECT SERVERPROPERTY('EngineEdition'))) = 3) 
            BEGIN 
                    SELECT  partition_number AS 'PartitionNumber' 
                                    , prv.value AS 'End Date' 
                                    , used_page_count*8 AS 'Size in KB' 
                    FROM sys.dm_db_partition_stats pst LEFT OUTER JOIN sys.partition_range_values prv ON prv.boundary_id = pst.partition_number 
                    WHERE object_id = object_id('AuditBase') 
                    AND index_id in (0,1) 
            END 
    ELSE 
            BEGIN 
                    SELECT  DATENAME(qq, CreatedOn) AS 'Quarter' 
                                    , YEAR(CreatedOn) AS 'Year' 
                                    , COUNT(*) AS 'Rows' 
                    FROM AuditBase 
                    GROUP BY DATENAME(qq, CreatedOn), YEAR(CreatedOn) 
                    ORDER BY 'Year','Quarter' 
            END 
    


     And the result should look like:

    wrong.jpg

    But while we had the issue, the result looked like:

    wrong.jpg

    And in such cases the program code in the dll fails when it tries to convert values in "End Date" into DateTime

  • Suggested answer
    Community Member Profile Picture
    on at

    hey Peter,

    successfully and accidentialy we probably managed to solve this problem. This partitions that you uploaded in last screens are created by selecting "Full text-search" checkbox in CRM. After you uncheck this partitions are deleted and you can view the audit. We are on test phase with this, if you can check this also please confirm. The results can be seen after few hours(~12).

  • Peter72 Profile Picture
    1,815 on at

    Hi, I can confirm that full-text-search is the root cause of these partitions, we also found that during our investigations. I would suggest that Microsoft should improve the code in the respective dll of the CRM-Platform to exclude the partitions created by the full-text-search.

  • Michael F Profile Picture
    on at

    Hi Peter,

    facing excatly the same error here and we already traced this issue down, on our SQL server 2014, getting the same conversion error.

    How did you solve this yourself? You wrote it disappeared out of a sudden - did you switch off fulltextsearch in the meantime to get rid of this annoying bug?

    Did you re-enable FTS afterwards or will this return the error?

    cu,
    Michael

  • Peter72 Profile Picture
    1,815 on at

    Hi Michael

    no, we didn't switch off fulltextsearch... I assume some maintenance-job has corrected the behaviour automatically. It will re-appear probably, but as for now, we are not facing the issue again.

    Regards,

    Peter

  • Michael F Profile Picture
    on at

    Thanks Peter and sorry for the late reply.

    I've switched off Full-Text-Search for some days now and this issue did not disappear. When switching FTS on again I hoped that those Partition Functions and Values would clean up themselve but did not.

    Hence, I'm still searching for a solution to this annoying problem.

    Can you pls. post a screenshot of your maintenance Jobs from your SQL server?

    Those are the jobs that are currently running on our side:


    2016_2D00_10_2D00_05_5F00_091437.png

    Thanks,

    Michael

  • Michael F Profile Picture
    on at

    Today, after uprading CRM 2016 to 8.1.1 Microsoft provided a fix for this long standing bug!

    As a prerequisite it was necessary to upgrade the SQL Server 2014 using at least CU3 (cumulative update 3), guess the recently released CU5 would do the job, too.

    Afterwards we upgraded CRM 2016 to 8.1.1. and checked the audit log management. We can now confirm this has been fixed.

    I wonder why it took almost one single year for this to get fixed? Guess, Microsoft, your on-premise customers don't appear anymore on your roadmap.

    Michael

  • Peter72 Profile Picture
    1,815 on at

    Hi Michael, do you have additional Infos? Especially: is this fix also available for CRM 2016 on-prem? Is there a KB-Article related to this bug?

  • Peter72 Profile Picture
    1,815 on at

    Forget my Question :-) 8.1.1 is of course on-prem :-)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans