Sharepoint 2016 : Changes to default DaysToKeepUsageFile value
The Requestusage folder at C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\LOGS\ keeps the Page request data and are processed by the Timer job "Microsoft SharePoint Foundation Usage Data Processing " . The files will be cleared from the above mentioned location once its processed so that the disk space will not be consumed much. However with Sharepoint 2016 , it is noticed that the usage files are not getting cleared from the location even after the successful execution of the Timer job, this in turn causes the disk to be filled up.
Up on investigation , we found that the default DaysTokeepUsagefile value is 5 in SharePoint 2016, while the value of this property is 0 (Zero) in Sharepoint 2013 that means the data will be preserved on the disk for 5 days by default.
The below Powershell command will help you determine the current value set of DaysToKeepUsageFile
Get-SPUsageDefinition -Identity "Page Requests" | fl
TableName | RequestUsage |
UrlTypeFilter | {js, css, jpg, gif...} |
StatusCodeFilter | {202, 204, 206} |
UserAgentFilter | {Mozilla/4.0 (compatible; MSIE 4.01; Windows NT; MS Search 5.0 Robot), Mozilla/4.0 (compatible; MSIE 4.01; Windows NT; MS Search 6.0 Robot)} |
UserFilter | {SHAREPOINT\system} |
Columns | {WebApplicationId UniqueIdentifier, ServerUrl NVarChar(256), SiteId UniqueIdentifier, SiteUrl NVarChar(256)...} |
UsageEntryType | Microsoft.SharePoint.Administration.SPRequestUsageEntry |
Description | Page Requests |
DaysToKeepDetailedData | 7 |
RetentionPeriod | 7 |
ProvisionSchema | True |
Enabled | True |
DaysToKeepData | 365 |
DaysToKeepUsageFiles | 5 |
MaxTotalSizeInBytes | 10000000000000 |
EnableReceivers | False |
Receivers | {} |
Hidden | False |
UsageDatabaseEnabled | True |
Name | Page Requests |
TypeName | Microsoft.SharePoint.Administration.SPRequestUsageDefinition |
DisplayName | |
Id | 5971d5e1-8869-4a49-bbe9-67493c697ae2 |
Status | Online |
Parent | SPFarm Name=SharePoint_Config |
Version | 2983 |
DeploymentLocked | False |
Properties | {} |
Farm | SPFarm Name=SharePoint_Config |
UpgradedPersistedProperties | {} |
Retention | 7 |
How to modify the value to 0 (Zero) so that the files will be cleared every day?
$pr= Get-SPUsageDefinition | where {$_.Name -like "Page Requests"}
$pr.DaysToKeepUsageFiles=0
$pr.EnableReceivers=$true
$pr.Update()
Wait for the Timer job "Microsoft SharePoint Foundation Usage Data Processing" to process the data files
POST BY : Anoop Prasad [MSFT]
Comments
- Anonymous
August 23, 2017
Could you explain the EnableReceivers property? I already have it set to true and the Receivers collections has a Microsoft.Office.Server.Search.Analytics.Internal.ViewRequestUsageReceiver element. Should other usage definitions also have this set to true?- Anonymous
August 30, 2017
Not required Piotr.
- Anonymous