We have two different logs. One from SharePoint and one from IIS.
SharePoint 2010 Logs:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS
IIS Logs:
C:\inetpub\logs\LogFiles
The logs grow enormously and occupy most of the drive space on the Front End Server. This may affect the performance of the Server as all the Transactions are looped thru it.
To control the log files growing, we want to create Scheduled Tasks to delete the logs older than 4 days.
1. Delete SP Log more than 4 days
Created a VB Script file with below code and placed it in a Folder "Scripts" folder on C:\ Drive.
'DelSPLogs.vbs - August 19, 2013
'Venugopal Reddy Gurram
'Deletes SharePoint Logs more than 4 days
Dim i, fso, f, f1, sf, BasePath, CalcResult, fNameArray()
BasePath = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(BasePath)
Set sf = f.SubFolders
For Each f1 in sf
CalcResult = DateDiff("d",f1.DateCreated,Now)
if CalcResult > 4 then
ReDim preserve fNameArray(i)
fNameArray(i) = f1.Name
i = i + 1
end if
Next
For Each fName in fNameArray
FSO.DeleteFolder(BasePath & "\" & fName)
Next
2. Delete .usage Files more than 4 days.
We need to perform this activity manually.
Stop the "SharePoint 2010 Timer" service and start deleting the usage files in below folder.
SharePoint 2010 Logs:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS
Once Completed deletion, start the "SharePoint 2010 Timer" service
No comments:
Post a Comment