How to clear the SharePoint Usage Logs and/or Web

2019-05-29 04:03发布

How do I clear the SharePoint Usage Logs and/or Web Analytics Logs? I've tried deleting the *.usage files found in {SharePoint Hive}\Logs, and deleting the Usage Service Application as well as the Web Analytics Service Application?

The reason why I as is because I have a web part that determines the most visited sites. In my code I use the

SPWeb.GetUsageData(SPUsageReportType.url, SPUsagePeriodType.lastMonth)

method, and it always returns the same data. I would like to reset the values it returns.

2条回答
Animai°情兽
2楼-- · 2019-05-29 04:37

If you are just trying to restart the logging, try: ◦Open the ​"SharePoint 2010 Management Shell" (Powershell for SharePoint). ◦Type "New-SPLogFile"

Done.

The logs will be in "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS"

查看更多
一纸荒年 Trace。
3楼-- · 2019-05-29 04:38

Have you tried looking at the usage database? Usage might be backed by that database.

You can also limit the retention timeframe for specific usage items: Set-SPUsageDefinition -Identity"Page Requests" -DaysRetained 3 or see this blog post: How to reduce the size of logging database OR How to purge the old data from Logging Database.

Another way of clearing the logs is shown here using only central admin: How to Delete Usage Logs on Sharepoint. Sahhil Malik shows yet more ways to refresh the logs: SharePoint 2010 - Drives are running out of free space.

查看更多
登录 后发表回答