Translate

woensdag 8 april 2015

Clear Exchange 2013 Logging periodic and automatically? Yes we can.

Ever wondered why Exchange 2013 is filling your disk, within most of our opinion rubbish.....

Microsoft intended these files for problem logging and BigData.

But i don't want them. And most of us don't want the C: disk blown up from a important server.

Let's start how to get rid of these logging.

First of all you can shut it partially off, but when doing this most of the powerfull tools in Exchange like diagnostics are also powered down.... So don't.

Create a scheduled task on your exchange server.

Go to your desktop and create a file called "clear log files Exchange.xml" then open it and paste the text from below in your document. Save it, then change the blue marked areas. The last green marked item is the amount of days for keeping the logs. I personally set them on 2 days, the - before the amount of days is the days to keep before deleting the logs.

If you want to set this up for the inetpub logs too just change the path. This is marked red.

“C:\inetpub\logs\LogFiles”

Start below here:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2015-04-08T09:26:55.4403987</Date>
    <Author>"domain\User"</Author>
    <Description>cleares the log files from the exchange folder</Description>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2015-04-08T09:24:04.030706</StartBoundary>
      <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
      <Enabled>true</Enabled>
      <ScheduleByWeek>
        <DaysOfWeek>
          <Monday />
        </DaysOfWeek>
        <WeeksInterval>1</WeeksInterval>
      </ScheduleByWeek>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>"domain\User"</UserId>
      <LogonType>S4U</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>true</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
    <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\Windows\System32\forfiles.exe</Command>
      <Arguments>/p “C:\Program Files\Microsoft\Exchange Server\V15\Logging” /s /m *.* /c “cmd /c Del @path” /d -2</Arguments>
    </Exec>
  </Actions>
</Task>


Geen opmerkingen:

Een reactie posten