Thursday, November 24, 2016

Force update analytics components timer job


Issue: The popular items report for the document library are updated every 24 hrs and we cannot get the recent hits updated immediately.

Workaround: Following is the workaround to get the recent hits updated in the most popular items report for a document library

Prerequisite: Make sure that Reporting feature and Popularity Trends/usage analytics is enabled for the site

1. Make sure that the Search Analytics timer job is started.
$analyticsJob = Get-SPTimerJob -Type Microsoft.Office.Server.Search.Analytics.AnalyticsJobDefinition
$searchanalytics = $analyticsJob.GetAnalysis("Microsoft.Office.Server.Search.Analytics.SearchAnalyticsJob")
$searchanalytics.StartAnalysis()

  1. Trigger the events by opening and downloading some files from document library

  1. Make sure that the usage files @ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\RequestUsage are updated with the event details.

  1. Events can be imported from usage to Event store by running the Timer Job manually using following PowerShell script

$usagejob = Get-SPTimerJob -Identity ("job-usage-log-file-import")
$usagejob.RunNow()

  1. Make sure that the event store (C:\Program Files\Microsoft Office Servers\15.0\Data\Office Server\Analytics_<GUID>\EventStore)  is updated with the event

  1. Copy the current data event store logs to a custom folder location. In this example we have copied the logs to following location
    15 Hive\Data\Office Server\Analytics_<GUID>\EventStore\20161124\MyEvents

  1. Run the following PowerShell script to start the usage analytics

$uajob = get-sptimerjob -type microsoft.office.server.search.analytics.usageanalyticsjobdefinition
$uajob.DisableTimerJobSchedule()
$uajob.StartAnalysis("\\ilinksys-121\Office Server\Analytics_abce7b74-9002-404b-92b2-126bcddf451e\EventStore\20161124\MyEvents")
$uajob.EnableTimerJobSchedule()

Check the most popular items report once the job state is complete and you notice that the recent events are updated.

1 comment: