Solved

Log Files

Posted on 2011-09-11
6
406 Views
Last Modified: 2012-05-12
I have a dedicated server at Fasthosts with a few web domains. Windows Server 2003

Each domain automatically collects log files of each visit.

I wondered if it is possible to dispense with these log files, they get very large and I do not use them.
Can anyone advise me on this please?

Thank you

John
0
Comment
Question by:johnhardy
  • 3
  • 2
6 Comments
 
LVL 4

Expert Comment

by:vaibhavjaiman
ID: 36518675
Hello,

You can rotate the logs file ,Here is an example of the code under the vb script.

************************************************************************************************
Option Explicit

Dim intDaysOld, strObjTopFolderPath, strLogFIleSuffix, ObjFS, ObjTopFolder
Dim ObjDomainFolder, ObjW3SvcFolder, ObjSubFolder, ObjLogFile, ObjFile,ObjDomainsubFolder,ObjDomainlogsFolder

intDaysOld   = 3
strObjTopFolderPath = "C:\HostingSpaces"
strLogFIleSuffix = ".log"

Set ObjFS = CreateObject("Scripting.FileSystemObject")
Set ObjTopFolder = ObjFS.GetFolder(strObjTopFolderPath)

For Each ObjDomainsubFolder in ObjTopFolder.SubFolders  

For Each ObjDomainFolder in ObjDomainsubFolder.SubFolders

For Each ObjDomainlogsFolder in ObjDomainFolder.SubFolders

 For Each ObjW3SvcFolder in ObjDomainlogsFolder.SubFolders



  Set ObjSubFolder = ObjFS.GetFolder(ObjW3SvcFolder)

   For each ObjLogFile in ObjSubFolder.files

    Set ObjFile = ObjFS.GetFile(ObjLogFile)
    If datediff("d",ObjFile.DateLastModified,Date()) > intDaysOld and lcase(right(ObjLogFile,4))=strLogFIleSuffix then
     '*****************************************************
     'DON'T UNCOMMENT THIS UNTIL YOU KNOW IT WORKS PROPERLY!!!
     'WScript.Echo("Will delete " & ObjSubFolder.name & "\" & ObjFile.name)
     ObjFile.Delete
     '*****************************************************
    End If
    Set ObjFile = nothing
   Next
  Set ObjSubFolder = nothing
 Next
Next
 Next
Next

Set ObjTopFolder = nothing
Set ObjFS = nothing
************************************************************************************************

http://forum.dotnetpanel.com/forums/t/2991.aspx
http://forum.dotnetpanel.com/forums/p/1239/21163.aspx
http://forums.webhostautomation.com/showthread.php?t=18656
0
 
LVL 26

Accepted Solution

by:
Leon Fester earned 500 total points
ID: 36522118
Log files are only needed when you are troubleshooting a problem or if you are using the logs for traffic and/or site analysis.
Otherwise It's just a waste of space then if you're not using them.
In that case I would suggest switching off the logging.

In IIS, Under the "Web Sites" folder,
right-click on your website
Click Properties
deselect "Enable Logging"
Click OK

Repeat for all other websites.

The default location for IIS log files is c:\windows\system32\logfiles\W3SVC1.
It is good practise to move this location away from your C: Drive.
0
 

Author Closing Comment

by:johnhardy
ID: 36522466
Many thanks for the solution, regret I did not understand the previous solution.

Thanks

John
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 4

Expert Comment

by:vaibhavjaiman
ID: 36522535
What i mean is that you can remove the logs files based on the log file date history.

Suppose if you are placing your website contents under the path

c:\domains\yourdomains-name\log\your logs files here

You can simply use the above script to delete the files older than 3 days.

Hope it might help you ,
0
 

Author Comment

by:johnhardy
ID: 36523244
Thanks vaibhavjaiman
I understand now more fully but regret that you solution is too advanced for me.

Sorry

Regards

John
0
 
LVL 4

Expert Comment

by:vaibhavjaiman
ID: 36527496
No Problem,

Hope it will help you in future.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now