Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

IIS Log files on Exchange 2013 server

Posted on 2016-11-08
6
Medium Priority
?
1,053 Views
Last Modified: 2016-11-10
I have an exchange 2013 dedicated VM, windows server 2012 r2.  I have 2 partitions.  130gb c: and 750gb data E where the exchange database resides.  The problem is C is filling up with IIS log files.  there is about 90gb of log files and only about 8gb of space left.

What is the best and safest way to purge the IIS log files (located c:\inetpub\logs\logfiles\w3svc1 and w3svc2) where it won't negatively affect the server?
0
Comment
Question by:sandan9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 4
ID: 41879542
Run this.  Set it up as a batch for later.   I have it set to delete all logs except for the last 7 days.  You can change that by changing the $days variable to something else.  


Set-Executionpolicy RemoteSigned
$days=7
$IISLogPath="C:\inetpub\logs\LogFiles\"
$ExchangeLoggingPath="C:\Program Files\Microsoft\Exchange Server\V15\Logging\"
$ETLLoggingPath="C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\ETLTraces\"
$ETLLoggingPath2="C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\Logs"
Function CleanLogfiles($TargetFolder)
{
    if (Test-Path $TargetFolder) {
        $Now = Get-Date
        $LastWrite = $Now.AddDays(-$days)
        $Files = Get-ChildItem $TargetFolder -Include *.log,*.blg, *.etl, *.txt -Recurse | Where {$_.LastWriteTime -le "$LastWrite"}
        foreach ($File in $Files)
            {Write-Host "Deleting file $File" -ForegroundColor "white"; Remove-Item $File -ErrorAction SilentlyContinue | out-null}
       }
Else {
    Write-Host "The folder $TargetFolder doesn't exist! Check the folder path!" -ForegroundColor "white"
    }
}
CleanLogfiles($IISLogPath)
CleanLogfiles($ExchangeLoggingPath)
CleanLogfiles($ETLLoggingPath)
CleanLogfiles($ETLLoggingPath2)

Open in new window

1
 
LVL 16

Expert Comment

by:Todd Nelson
ID: 41879930
Take a look at this reference, as well as the reference links...

https://oddytee.wordpress.com/2014/09/11/references-remove-exchange-2013-diagnostic-log-files/
0
 
LVL 28

Accepted Solution

by:
Dan McFadden earned 1000 total points
ID: 41880014
Deleting the IIS logs will not affect the server, IIS or Exchange.  Also, you could enable compression of the IIS site log directory (C:\inetpub\logs\LogFiles\), this will save plenty of space since the logs files are highly compressible.

Dan
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

Author Comment

by:sandan9
ID: 41881106
HI.  Thanks for the comments and help.  Reading the batch file, my only concern is my backups that run daily remove the logs once the backup complete, so the exchange log files located on E:\Program Files\Microsoft\Exchange Server\V15\Logging are not an issue.  I would only want to purge the IIS files exclusively.

The link provided mentions the exchange logs, which I thankfully don't need to worry about.

I will try the compression.  Great idea.  I will let you know how it works.  Thanks!
0
 
LVL 4

Assisted Solution

by:get-ADuser -F ($_.Name -eq "Todd")
get-ADuser -F ($_.Name -eq "Todd") earned 1000 total points
ID: 41881169
You can change my script to just remove the IIS logs.  It removes everything including IIS.  I have it remove everything because my backup solution does not remove the Exchange logs.  But the script I provided removes the IIS logs which is the bulk of my system drive filling up.
0
 

Author Closing Comment

by:sandan9
ID: 41882693
Thank you all for the information.  I kept the batch file for future potential use.  Enabling compression worked perfectly.  went from 90gb to 50gb, compressing 40gb which gets me out of the woods.  Thanks again.
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.

Question has a verified solution.

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

After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
In this Micro Tutorial viewers will learn how they can get their files copied out from their unbootable system without need to use recovery services. As an example non-bootable Windows 2012R2 installation is used which has boot problems.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the adminiā€¦

704 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