Home Contact

The Frog Pond of Technology

Ripples of Knowledge for SharePoint and Other .Net Technologies

News

My blog has moved to WordPress at BrianTJackett.com. Any pages will automatically redirect to the new address in 7 seconds. Please excuse an issues during this migration.

 Subscribe to this blog


About Me

Name:
Brian T. Jackett
Location:
Columbus, OH
Company:
Microsoft

Find me on...

Tag Cloud


Archives

Post Categories

Syndication:

PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

   Over the past few months I’ve had 2 customers that have run into an scenario where the SharePoint 2013 web analytics usage reports have no data (all zeroes) in the reports.  While working with some brilliant Microsoft escalation engineers (thanks Anthony and Jason) we were able to run some PowerShell scripts that added receivers to start data showing again on the following day.  Since I haven’t seen any posts on this as of yet I thought I would post a version of the PowerShell scripts we used.

 

Scenario

    In SharePoint 2013 the search service application incorporates web analytics (which is a separate service application in SharePoint 2010).  Web analytics processes usage logs on the SharePoint machines and generates reports on a daily schedule.  These reports can be viewed for an individual site in the site settings under Site Collection Administration > Popularity and Search Reports.

UsageReportDataEmpty1

 

   In the Popularity and Search Reports you can click on the Usage report which will launch an Excel workbook.

UsageReportDataEmpty2

 

   What I found with 2 customers and one of my lab farms was that the Usage report contained all zeroes for data even though the customer (and me in my lab farm) had been using the site regularly with multiple accounts over the past few days.

UsageReportDataEmpty3

 

   We analyzed the logging database and found that it had usage data, but the search analytics database did not.  (Note: do not directly query the search analytics database as that is unsupported as of the time this post was written.  See http://technet.microsoft.com/en-us/library/cc678868.aspx for more information.)  So it appeared the data in the logging database wasn’t being processed by the search service web analytics timer jobs.  After verifying that the timer jobs were indeed running the long road of PowerShell queries into the system began.  We finally used the below commands to arrive at what we believe to be the culprit for these customers.  Our findings follow the commands.

 

001
002
003
004
005

$aud = Get-SPUsageDefinition | where {$_.Name -like "Analytics*"}
$aud | fl

$prud = Get-SPUsageDefinition | where {$_.Name -like "Page Requests"} 
$prud | fl

 

  • AnalyticsUsage usage definition had no Receivers defined
  • PageRequest usage definition had no Receivers defined

UsageReportDataEmpty4

 

    Not having any Receivers defined also led to the EnableReceivers property to be set to false for both.

 

Workaround

   The workaround in these scenarios was to manually create the Receivers.  The PowerShell commands to do so is below (slightly modified to check for empty receivers first).  Again this sample script is provided as-is with no warranty.  Do not run this in your environment without first testing.  This is not an official Microsoft approved script.  You can download a copy off my SkyDrive folder as well.

 

 

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040

if((Get-PSSnapin -Name Microsoft.SharePoint.PowerShell) -eq $null)
{
   
Add-PSSnapin Microsoft.SharePoint.PowerShell
}


$aud = Get-SPUsageDefinition | where {$_.Name -like "Analytics*"}

# if analytics usage definition receivers is empty then manually add back receiver
if($aud.Receivers.Count -eq 0
)
{
   
$aud.Receivers.Add("Microsoft.Office.Server.Search.Applications, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c", "Microsoft.Office.Server.Search.Analytics.Internal.AnalyticsCustomRequestUsageReceiver"
)
}


# if analytics usage definition receiver is not enabled then enable it
if($aud.EnableReceivers -eq $false
)
{
   
$aud.EnableReceivers = $true
    $aud.
Update()
}


$aud | fl


$prud = Get-SPUsageDefinition | where {$_.Name -like "Page Requests"} 

# if page requests usage definition receivers is empty then manually add back receiver
if($prud.Receivers.Count -eq 0
)
{
   
$prud.Receivers.Add("Microsoft.Office.Server.Search.Applications, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c", "Microsoft.Office.Server.Search.Analytics.Internal.ViewRequestUsageReceiver"
) 
}


# if page requests usage definition receiver is not enabled then enable it
if($prud.EnableReceivers -eq $false
)
{
   
$prud.EnableReceivers = $true
    $prud.
Update()
}


$prud | fl

 

   After the script has been run the output from the prior commands can confirm that Receivers have been created and the EnableReceivers property is set to true.

UsageReportDataEmpty5

 

<Update 2013-08-09>

   The next step is to recycle the OWSTimer service (SharePoint Timer Service) on each server.  This ensures that the new receivers are properly picked up by the timer jobs.

</Update 2013-08-09> 

  Waiting one day the usage reports were now showing data.  (Note the below report was mocked up manually to show data as I did not have direct access to the customers’ reports, but this is consistent with what we had seen after the scripts were applied.)

UsageReportDataEmpty6

 

Conclusion

   This is a strange scenario of no data in the usage reports when there is data in the logging databases.  I’ve run into it myself and with 2 customers, but when I tried to reproduce the scenario I couldn’t.  If anyone is facing this issue hopefully this process of manually creating the usage definition receivers and waiting 24 hrs is a workaround.  Let me know if you have seen this and if the workaround works for you.  Curious to learn more on it.

 

      -Frog Out


Monday, August 26, 2013 9:56 PM

Feedback

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

I just ran into this issue we had no recievers. Ran your script minutes ago and it updated the recievers, now I wait. I will post back if it fixed 8/28/2013 2:25 PM | ryan

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Ryan,

Thanks for trying out. I forgot one piece of information. After you add the receivers back you'll also need to recycle the OWSTimer service on each server. I've updated the blog post to reflect this. If you don't have data on the following day try that and see if that helps.
8/29/2013 9:50 AM | Brian T. Jackett

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Yes this did fix the issue I was having thank you! 8/30/2013 12:03 PM | ryan

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Ryan,

Glad to hear it helped.
8/30/2013 11:29 PM | Brian T. Jackett

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Thank you, this helped me a LOT!

9/26/2013 3:22 AM | Francis Lane

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

I had been searching for this for months, thanks for the help!!! 10/9/2013 5:00 AM | Rob

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

My both event handlers are working fine and I restarted the timer job, still I got 0 count ( for Unique user and hits).
but this was working fine two months back

My current report ( usage)
================
July - i have records
August - I have records
Sep - 0
Oct -0

But for "Number of Queries" i have values....

Kindly give me a solution for this....


11/6/2013 2:25 AM | prasath

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Prasath,

Check to see if your Usage and Health Data Collection service application and service application proxy are started. Also check your WSS_Logging database if it has data populated in the tables for page requests.
11/7/2013 6:23 PM | Brian T. Jackett

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Hi
Microsoft.Office.Server.Search.Analytics.Internal.AnalyticsCustomRequestUsageReceiver
doesnt seem to exist. I an unable to find any doco or reference it in visual studio. Am I missing something. 12/5/2013 11:57 PM | Mayank

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Hi
The usage stats seem to be 2 days apart. ine usage entry is for 6/12 and the other is 9/12 nothing inbetween. Can you help 12/12/2013 12:21 AM | Mayank

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Mayank,

It could be that the timer job to collect the data for those 2 missing days did not run properly, the data was corrupted, or a number of other reasons. Hard to know without investigating further.
12/12/2013 10:51 PM | Brian T. Jackett

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Thanks. I notice that for the 12/12 and 13/12 the data was collected. although it is not consistent. Also some documents library have the report and some don't. Can you suggest any troubleshooting steps I can take to resolve this issue? 12/15/2013 9:10 PM | Mayank

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Thank you so much! I've been plagued by this since day one and I couldn't figure out why I had search analytics, but no usage! Both of my receivers were missing, but not any more. 2/11/2014 3:05 PM | Bruce

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Thanks guys, you helped a lot. 2/12/2014 1:42 AM | Alex

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Many thanks for this Brian!!! 4/22/2014 6:45 AM | Roger Glass

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Brian, thanks for this INFO, but I have a question, does this apply both for Standard and Enterprise CALs?
Im trying to use the ViewsRecent managed properties on a Search Results webpart without success, and I cannot see Usage Reports anywhere.

Thanks a lot! 6/11/2014 10:47 AM | David Arango

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Brian, I ran your script to fix my development env. However it didn't fix my uat env. All the analytic reports show zero count. What else I can do? (I have recycled OWSTimer)

Not sure why Microsoft make their official feature so difficult to setup? 8/14/2014 11:23 PM | Mark

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Brain, I want to add that there is no official solution to fix this problem. I install several SP2013 farm and all of them had no Receivers defined by default. 8/14/2014 11:38 PM | Mark

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

I am facing this issue at the page level. As you know, you can click the Popularity Trends menu on each page to view usage data for that page. In my SharePoint deployment, I can see usage data for every page except one which is the Default.aspx page. When I queried the AnalyticsItemData table, it showed LastProcessingTime of Dec 15, 2014. 1/26/2015 10:56 AM | Artie

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Hi Brian,

Thanks for your wonderful scripts. Unfortunately, which I ran the customer's machine. On SharePoint 2013 app and front end servers. and ran timer job for all servers but even after 2 days no data was shown up.

I tried other options such as:
i. Microsoft SharePoint Foundation Usage Data and
ii. Microsoft SharePoint Foundation Usage Data Processing. Both were enabled. I re-run the job schedules again.
iii. C:\Program Files\Microsoft Office Servers\15.0\Data\Office Server\AEStore today's and past folders were there.

however, I did not verify the search service application and WSS_Logging database.

Any other pointers that I could run the scripts so that usage report are available for the customer?

Thank you.
2/5/2015 3:10 AM | aroh

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Hi Brian,

The site analytics were working earlier. Recently, the customer reported this issue and I used your scripts.


2/5/2015 3:16 AM | aroh

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Hi Brian,

We have two site collections in our environment. One is root site collection and another one is searchcenter site collection. Usage reports are showing data for root site collection but not for searchcenter site collections. However other reports like "number of queries" and "top queries by day" reports are showing data. I have checked logging database, it has data in it. All jobs are running fine and also we don't see any errors in search crawl jobs. Also these receivers are enabled. Couldn't see any errors in log files too.

Can you please help with this issue. 4/1/2015 4:13 PM | sandeep

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

We are having this same problem in O365. I have opened a ticket with Premier support because I can't run scripts like this in SPOnline 4/20/2015 8:47 AM | Dean Gross

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Hello,

Thanks for the post,

I have a standalone Sharepoint Server 2013, the receivers are defined, I did not run the script and I am still not showing up data from the last month, there rest of the previous months I have data.
I can see the data on the SQL server.

Can you help me?

Regards 5/8/2015 4:25 PM | Diogo

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Diogo... Monday.. I will revisit this post and provide you with some info.. will that work? I have worked with Brian before and I am pretty familiar with Analytics in 2013.. 5/15/2015 4:46 PM | Anthony Casillas

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

We had the same problem on our farm and the script corrected it.
Two ideas:
- We used autospinstaller
- I read this on Microsoft documentation 'Only Search analytics is available to SharePoint Server 2013 Standard CAL customers. Usage analytics is not available.' 5/28/2015 12:02 PM | KTNN

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Many thanks for sharing this gem with us. It worked great on the first try and next day I was able to see the counts in the report.

Much Appreciated!! 9/23/2015 9:11 AM | Kauser T.

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

I have the same issue on my SP2013 farms, activity was working some time ago but after reverting the farms it displays 0, I have reviewed the receivers and both are configured in the same way as yours, DB is showing activity but report is displaying 0, do you have any idea of my problem?.

Thanks in advance!!

PS: Nice post BTW! 10/26/2015 5:48 PM | Daniel

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Most popular items is specific to site collection?

last month i have fixed the issue for one site( Sub site) and Most popular items were showing as expected.

After 2 weeks another user reported the issue for different issue and fixed the issue and now results were showing as expected.

What is the permanent fix. Popularity trends is specific to site. 12/2/2015 4:25 PM | Baabu

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Thanks it help me .....
Resolve issue 12/6/2015 4:33 AM | Arshad

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Hello,

Both of my event receivers are enabled. And my timerjob is also started. But yet it is showing me 0 data in usage reports. What must be the reason. 12/7/2015 8:50 AM | Niranjan Kulkarni

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Hi,

Even after execution of powershell and time service restart and after one day still getting output as 0. I checked the usage log report its running fine, only popularity trends is not working. Kindly suggest your viewpoint 2/25/2016 12:11 AM | vijay verma

# re: PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

tmer jobs are also running and receivers are also enabled.
Still getting 0 results in Popularity trend report
Can someone please help 5/19/2016 9:26 AM | Prachi

Post A Comment
Title:
Name:
Email:
Comment:
Verification: