Appelman
Appelman

Reputation: 145

How to clear the SharePoint Usage Logs and/or Web Analytics Logs

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.

Upvotes: 2

Views: 43873

Answers (3)

sandeep yadav
sandeep yadav

Reputation: 107

You may delete WEB Analytics Service along with associated Data under Application Management->Service Applications->Manage service applications

select web analytics from service and delete it along with associated data

Upvotes: 0

MBentley
MBentley

Reputation: 1016

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"

Upvotes: 0

Dennis G
Dennis G

Reputation: 21788

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.

Upvotes: 3

Related Questions