EXCHANGE 13/16清理IIS LOGS日志文件(含脚本)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了EXCHANGE 13/16清理IIS LOGS日志文件(含脚本)相关的知识,希望对你有一定的参考价值。

EXCHANGE 2013\2016清除IIS LOGS 日志文件。

在完成安装后,即使EXCHANGE不安装在系统盘也会在系统盘下生成IIS日志文件,使用RPC overHTTPMapi overHTTP协议,所以都是IIS提供各种服务,这些日志是每次用户连接到exchange时的日志,可以用来诊断连接问题或者安全问题。

 

默认位置:C:\inetpub\logs\LogFiles(默认C为系统盘的话)

可以在IIS管理器里面更改存储目录为别的盘符,并直接删掉这些目录文件,也可使用脚本进行清理。

 

IIS管理器位置截图:




技术分享



Exchange 2013 Logging: Clear outthe log files

Table of Contents



In your Exchange 2013 environment you may be wondering why the space on yourC:\ drive where Exchange is installed is filling up so quickly. 

Thisis due to the amount of logging Exchange 2013 does by default. Microsoft turnedthis on to assist them with more rapid assistance with customers instead ofwaiting for logs.

FromCU6 for Exchange 2013, .etl files were created. With the current build Exchange2013 creates 50MB files at a time with a maximum of 100 files. For smallerbusinesses this is not ideal.

Theother feature that logs weekly and daily files is the Diagnostic logs (Healthexplorer). This will generate files up to 5GB over a week/month. Some of youmight want that space because you are limited with the current hardware youhave.

Theother player here is IIS logs. These can generate quite a bit and at 500MB+ alog file you can run out of space rather quickly.

Lastly,another set of logs that could be filling up is the HTTP Proxy log. Thislog will fill up in most cases when you have issues and will create an hourlyfile from 4MB onward.

Inthis article we will go through each of the following logs below and explainhow you can maintain them or turn them off:

themoff:

Lastly,a PowerShell script is available to run a clean up without having to go intoeach folder.

Diagnostic Logs

HealthManager runs and collects information about the health of the system. If youhave ample space this is fine but if you have an 80GB C:\ drive your drive isgoing to fill up in less than a few days. If you need to disable this featureyou can do so as follows:

Openup Services.msc,

技术分享


  • Locate     the Microsoft Exchange Health Manager Service.

  • Double     click the service and change the startup to disabled. 

  • Stop     the service if it is running.

技术分享


  • The     next service to locate is the Microsoft Exchange Diagnostics Service.

  • Follow     the same steps as above to stop and disable the service.

Thenext thing to stop/disable is the task that runs. Open up Task Scheduler.

disable is the taskthat runs. Open up Task Scheduler.

技术分享


·   In TaskScheduler, expand Microsoft -> Windows and then click on PLA.

·   You will seetwo tasks, first stop them if they running and then disable them.

The next step is toclear out the logs created by Diagnostics. Open up Explorer.

技术分享


Navigate toC:\Program Files\Microsoft\Exchange Server\V15\Logging\Diagnostic.

·   In there youwill have two folders, one called DailyPerformanceLogs and theother PerformanceLogsToBeProcessed.

·   You candelete all the log files located in these two. The logs to beprocessed will contain 20MB files while the daily logs will be +/- 1GB.

 

ETL Files

Thesefiles are generated almost every hour and are about 50MB in size. The defaultregistry entry for this is to keep 100 files. We will adjust this value furtherdown.

Tolocate these files go to the following location:

  • C:\Program     Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\ETLTraces    

技术分享


·   As shownabove, there are a lot of files logged. You can highlight all of them anddelete them without a problem. This will free up a few GB.

Within theDiagnostics folder there is another folder that is logging. Here is thelocation:

·   C:\ProgramFiles\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\Logs

  • As you can see above, a lot of log files are here and youcan delete these text files.



Registry Change

Youcan change the default value of 100 files to a number you want by changing thefollowing registry key:

  • Key:     MaxTraceFileCount

  • Registry     Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office     Server\16.0\Search\Diagnostics\Tracing



IIS Log Files

IISLog files write to the C:\inetpub directory by default. You can changethis to another drive, etc. These files can be 200MB+ and overtime will use upspace on the drive. To delete them, open up the following location:

  • C:\inetpub\logs\LogFiles    

技术分享


·   Inside thisfolder you will have two other folders namely W3SVC1 and W3SVC2.Inside these are log files you can delete as well.

You can also lookin the following folder for the same set of folders: C:\ProgramFiles\Microsoft\Exchange Server\V15\Logging\RpcHttp

技术分享


Here you canalso delete these files.



HTTP Proxy Logs

Thelast place you can look as well for log files is in this location:

  • C:\Program     Files\Microsoft\Exchange Server\V15\Logging\HttpProxy

Locatedin each of the folders some files can be 10MB in size and generate quite a few.These logs will tell you if you have errors in your environment especially theRpcHttp folder.

Conclusion

Youshould be able to free up a few GBs of space.

PowerShell Script

Ascript was also created which you can use in conjunction with Task Scheduler toclear files when you need to. You can find the script here:

https://gallery.technet.microsoft.com/Clear-Exchange-2013-Log-71abba44技术分享

以上链接可下载清理脚本。



本文出自 “记录点滴技术” 博客,请务必保留此出处http://seawind.blog.51cto.com/6845370/1884577

以上是关于EXCHANGE 13/16清理IIS LOGS日志文件(含脚本)的主要内容,如果未能解决你的问题,请参考以下文章

自动清理IIS log 日志脚本

exchange 2013 C盘空间不足清理

定期删除IIS日志文件

Exchange13/16恢复丢失或损坏的迁移邮箱

Exchange13/16启用垃圾邮件功能及白名单设置

EXCHANGE13/16反恶意软件保护