This article is to share a case study about SharePoint usage analytics (pageviews specifically) which is captured and updated by SharePoint (out-of-the-box feature).
B - CASE STUDY & THE PROBLEM :
- Search Service Application has several interesting services, including (1) Search Analytics and (2) Usage Analytics, and we can make use of the value ViewsLifetime (a managed property in the search application) to show the pageviews at a certain item.
- To view the value ViewsLifetime of a certain page, you can use the URL (path to be updated): http://sitecollectionURL//_api/search/query?querytext='path:http://sitecollectionURL/news/Pages/ArticleURL.aspx'&sortlist='ViewsLifeTime:descending'
- The problem happens when the value ViewsLifetime is not updated properly and no value is captured in the EventStore, and the pageviews does not work.
C - TROUBLESHOOTING & SOLUTION:
A couple of online questions have no answer, such as:
https://social.msdn.microsoft.com/Forums/office/en-US/bcbd2474-31a0-4b09-97cc-67fa19d9ef3f/usage-analytics-event-store-not-updating-popularity-reports-showing-0-delete-usage-receivers?forum=sharepointdevelopment
The value ViewsLifetime is updated by the timer job Usage Analytics which run once a day (usually at 1am) to analyse all raw usage logs captured by the timer job Usage Data Import (run once every 5 mins).
We checked the scheduled jobs related to the services, and they work:
- Further check showed that the receivers of the relevant services have worked well.
- We manually run the service Analytics, but the RequestUsage folder at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\RequestUsage is not updated
- We manually check the service Data Import, but the EventStore is not updated as well.
Solution:
At the staging environment: (app & web roles are in the same server) we restarted the application server, and it worked. EventStore is updated properly again and the ViewsLifetime is updated.
At the production environment:
- Step 1: knowing that the Usage Analytics is under the process wsstracing.exe in Services, you must use the tool Procmon to trace its logs (Tool Link: https://docs.microsoft.com/en-us/sysinternals/downloads/procmon )
- Step 2: the abnormal result in this case is "Name Collision" in the wsstracing.exe runtime
- Step 3: you should both/either restart the wsstracing.exe service and/or drill down to the affected folder.
- Step 4: we restarted the service wsstracing.exe but the problem could not be resolved.
- Step 5: we rename the problematic folder (which seems to be corrupted) to AffectedFolder2, and re-create the same folder to let the service run. If the folder cannot be renamed (e.g. TimerJobUsage), please go inside the folder and delete all outdated files (with the last modified date is before today).
- The issue at production is resolved!
D - USEFUL RESOURCE:
1. https://www.linkedin.com/pulse/20140724173810-70514633-sharepoint-usage-report-in-sp-2013-is-merged-in-search-service-application
2. https://blogs.technet.microsoft.com/tothesharepoint/2014/01/23/view-and-configure-usage-analytics-reports-in-sharepoint-server-2013
3. https://blogs.msdn.microsoft.com/spblog/2014/04/03/sharepoint-2013-usage-analytics-the-story