[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1015
  • Last Modified:

Is possible to change the location logs in W3SVC1 of Exchange 2003?

The Active Synch logs are located in: C:\WINDOWS\system32\LogFiles\W3SVC1

Where this path is set in Exchange 2003 for that? Is possible to change the path for somewhere else than C drive?
0
SAM2009
Asked:
SAM2009
  • 2
  • 2
1 Solution
 
Sanjay SantokiCommented:
Hello,

Yes, you can change it to custom location from the IIS. Open IIS management console -> Properties of Default web site -> Click Properties at the bottom of web site tab. Here you can change the logging path to your own choice.

Thanks,
Sanjay Santoki
0
 
SAM2009Author Commented:
Thanks.

1- Could we automatically set something that will delete logs older than x days.

2- What logs are put in that folder?
0
 
SAM2009Author Commented:
I expect an answer to my last questions... but thank you anyway for your first answer.
0
 
Sanjay SantokiCommented:
Hello,

Sure, you can have a HELM Log file maintainance script that will remove files older than xx days. Please find the script code as below. It is a .vbs file.

Thanks,
Sanjay Santoki


Option Explicit


'**********************************************************************************
' Log File Maintainance for Helm Web Servers
'==================================================
'
'This application is unsupported. Using this application is at your own risk
'WebHost Automation Ltd takes no responsibility for the use of this application.
'
'This application must only be used where daily log files are generated by IIS.
'
'Installation
'-------------
'Update the following settings to relect the setup of your webserver
'
'This value should be set to the name of your server. Keep this to the same format
'as the example value.

Const serverName="\\servername\"


'This value should be set to the root path to all of the domains on the webserver.
'Keep this to the same format as the example value. If you have more than one location
'of website folders you can have multiple copied of this script running for each location

Const DomainPath="C$\Domains\"


'This value sets the number of days worth of logs that should be kept. Any log files,
'either compressed or uncompressed, will by removed if they are older than the number of
'days set.

Const RemoveOlderThan=30


'To complete this application installation type in the following command into the
'command prompt so that the application runs within a command prompt instead of producing
'hundreds of message boxes:
'                cscript //h:cscript
'
'The final step is to add this script into the Windows scheduled tasks. It's best not to set
'this script to run too close to midnight as Helm may be collecting log information at this time.
'Generally the quietest hosting time is around 6-7am.
'**********************************************************************************



Dim fso, fDomDir, fLogDir, fLog, todayDate

todayDate=cDate(day(now) &" "& MonthName(Month(Now),true) &" "&  Year(Now))
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(serverName & DomainPath) Then 
	RaiseError "Can Not Find Domain Folder"
Else
	getDomainStats
End If

set fso=Nothing


'================Functions==============

Private Sub GetDomainStats()
	Dim WshShell, CABReturnCode, CABCommand
	Dim fileDate
	Set WshShell = WScript.CreateObject("WScript.Shell")
	For Each fDomDir in fso.GetFolder(serverName & DomainPath).SubFolders
		DebugOut("Checking Domain "& UCase(fDomDir.Name))
		If fso.FolderExists(fDomDir.Path &"\Logs") Then
			For Each fLogDir in fso.GetFolder(fDomDir.Path &"\Logs").SubFolders
				For Each fLog in fLogDir.Files
					If UCase(Left(fLog.Name,2))="EX" And UCase(Right(fLog.Name,4))=".cab" Then
						fileDate=cDate(Mid(fLog.name,7,2) &" "& monthname(cint(Mid(fLog.name,5,2)),true) &" "& Mid(fLog.name,3,2))
						If fileDate< DateAdd("d", toDayDate, -RemoveOlderThan) Then
							DebugOut("Deleting "& flog.name)
							fLog.Delete
						End If
					ElseIf UCase(Left(fLog.Name,2))="EX" And UCase(Right(fLog.Name,4))=".LOG" Then
						fileDate=cDate(Mid(fLog.name,7,2) &" "& monthname(cint(Mid(fLog.name,5,2)),true) &" "& Mid(fLog.name,3,2))
						If fileDate< DateAdd("d", toDayDate, -RemoveOlderThan) Then
							DebugOut("Deleting "& flog.name)
							fLog.Delete
						Else
							'---CAB logfile----
							if fileDate < todayDate Then
								CABCommand = "MAKECAB /V1 "& fLog.Path &" "& Left(fLog.Path,Len(fLog.Path)-3) &"cab"
								CABReturnCode = WshShell.Run(CABCommand, 7, True)
							If (Err.Number <> 0) Then
								RaiseError Err.Description & " (" & Err.Number & ")"
							ElseIf (CABReturnCode <> 0) Then
								RaiseError "Return code from MAKECAB.EXE was " & CABReturnCode
							Else
								fLog.Delete
							End If
						End If
						End If
						'---Done---
					End if
				Next
			Next
		Else
			RaiseError "Can Not Find The Log Folder"
		End If
	Next
	Set WshShell=Nothing
End Sub

Private Sub DebugOut(strDebugText)
	WScript.Echo strDebugText
End Sub


Private Sub RaiseError(strErrText)
	WScript.Echo "ERROR: "& strErrText
End Sub

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now