Solved

Log Files

Posted on 2011-09-11
6
409 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
.Net Web Site IIS Web.Config Content-Security-Policy 1 188
Use CRON to save a copy of an open file 1 73
Wants to Upgrade fro Vista to Windows 10 9 70
Independent OS 7 49
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
#Citrix #POC #XenDesktop #vCenter #VMware #ESX
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
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…

749 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