sglee
asked on
Keep Log folder in Exchange 2010
Hi,
I have SBS2011/Exchange 2010 and am doing some clean up in OS hard drive(C drive).
I noticed that there are bunch of old files C:\Program Files\Microsoft\Exchange Server\V14\Logging\lodctr_ backups folder dated from 2011 thru 2013 and they are taking up over 3GB of space on C drive.
Do I need to keep any of these files?
I set up this server around 2011 and I probably updated Exchange server once or twice in year 2003.
Thanks.
I have SBS2011/Exchange 2010 and am doing some clean up in OS hard drive(C drive).
I noticed that there are bunch of old files C:\Program Files\Microsoft\Exchange Server\V14\Logging\lodctr_
Do I need to keep any of these files?
I set up this server around 2011 and I probably updated Exchange server once or twice in year 2003.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@Hamil,
I run Windows Server backup daily where I can go back so many months, but I will make copies of these files into another computer for a year or so.
"Those logs are transaction logs it wouldn't impact the server. " --> If this is case, do I even need to archive them?
@Ronin
I will run script and report back.
I run Windows Server backup daily where I can go back so many months, but I will make copies of these files into another computer for a year or so.
"Those logs are transaction logs it wouldn't impact the server. " --> If this is case, do I even need to archive them?
@Ronin
I will run script and report back.
If you have the latest backup, then go ahead. It's a just in case something happen you know, you know how IT environment is.
You dont have to. But if it something happen one day and you want to see what happened you might need it.
But it's up to you.!
You dont have to. But if it something happen one day and you want to see what happened you might need it.
But it's up to you.!
ASKER
@Ronin,
I opened WindowsPowerShell, ran this powershell command and got an "Permission related" error message:
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\admin> get-childitem -Path C:\inetpub\logs\LogFiles\w 3svc1 -recurse | where-object {$_.lastwritetime -lt
(get-date).addDays(-365)} | Foreach-Object { del $_.FullName }
Remove-Item : Cannot remove item C:\inetpub\logs\LogFiles\w 3svc1\u_ex 130118.log : Not Enough permission to perform opera
tion.
At line:1 char:147
+ get-childitem -Path C:\inetpub\logs\LogFiles\w 3svc1 -recurse | where-object {$_.lastwritetime -lt (get-date).addDays(
-365)} | Foreach-Object { del <<<< $_.FullName }
+ CategoryInfo : PermissionDenied: (C:\inetpub\logs...\u_ex13 0118.log:F ileInfo) [Remove-Item], IOExceptio
n
+ FullyQualifiedErrorId : RemoveFileSystemItemUnAuth orizedAcce ss,Microso ft.PowerSh ell.Comman ds.RemoveI temCommand
I opened WindowsPowerShell, ran this powershell command and got an "Permission related" error message:
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\admin> get-childitem -Path C:\inetpub\logs\LogFiles\w
(get-date).addDays(-365)} | Foreach-Object { del $_.FullName }
Remove-Item : Cannot remove item C:\inetpub\logs\LogFiles\w
tion.
At line:1 char:147
+ get-childitem -Path C:\inetpub\logs\LogFiles\w
-365)} | Foreach-Object { del <<<< $_.FullName }
+ CategoryInfo : PermissionDenied: (C:\inetpub\logs...\u_ex13
n
+ FullyQualifiedErrorId : RemoveFileSystemItemUnAuth
First you need to allow execution of scripts on the system.
To view current permission level, execute:
Next, run regular PS as Administrator and set the execution policy to Unrestricted.
After script is finished running, set the PS execution level back to the previously recorded setting.
To view current permission level, execute:
Get-ExecutionPoliocy
Note the output.Next, run regular PS as Administrator and set the execution policy to Unrestricted.
Set-ExecutionPolicy Unrestricted
Navigate to the location of the script and execute it.After script is finished running, set the PS execution level back to the previously recorded setting.
ASKER
I opened Administrator:Windows PowerShell and ran Get-ExecutionPolicy and I get an error.
I ran "Set-ExecutionPolicy Unrestricted" on the same window, successfully.
I placed ClearLogsExchange2010.PS1 file in downloads folder. In the same PowerShell window, I changed the directory to Downloads folder and ran .\ClearLogsExchange2010.PS 1 and I got an error.
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\admin> Get-ExecutionPoliocy
The term 'Get-ExecutionPoliocy' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS C:\Users\admin> Set-ExecutionPolicy Unrestricted
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes
PS C:\Users\admin\downloads> .\clearlogsexchange2010.ps 1
Remove-Item : Cannot remove item C:\inetpub\logs\LogFiles\w 3svc1\u_ex 130118.log : Not Enough permission to perform operation.
I ran "Set-ExecutionPolicy Unrestricted" on the same window, successfully.
I placed ClearLogsExchange2010.PS1 file in downloads folder. In the same PowerShell window, I changed the directory to Downloads folder and ran .\ClearLogsExchange2010.PS
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\admin> Get-ExecutionPoliocy
The term 'Get-ExecutionPoliocy' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS C:\Users\admin> Set-ExecutionPolicy Unrestricted
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes
PS C:\Users\admin\downloads> .\clearlogsexchange2010.ps
Remove-Item : Cannot remove item C:\inetpub\logs\LogFiles\w
It should read: Get-ExecutionPolicy and not Get-ExecutionPiolicy
Right-click on regular PS icon, not EMS, Run as Administrator
Run the script.
Right-click on regular PS icon, not EMS, Run as Administrator
Set-ExecutionPolicy Unrestricted
Navigate to the location of the script, c:\temp as an example in the same PS window.Run the script.
Wouldn't be better if you go to the directory and delete them?
Is the same thing.
Is the same thing.
ASKER
I am still getting an same error message about permission. I right-clicked and selected "Run as Administrator".
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\admin> Get-ExecutionPolicy
Unrestricted
PS C:\Users\admin\downloads> .\clearlogsexchange2010.ps 1
PS C:\Users\admin\downloads> set-executionpolicy unrestricted
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes : Y
PS C:\Users\admin> cd downloads
PS C:\Users\admin\downloads> .\clearlogsexchange2010.ps 1
Remove-Item : Cannot remove item C:\inetpub\logs\LogFiles\w 3svc1\u_ex 130118.log : Not Enough permission to perform opera
tion.
At C:\Users\admin\downloads\C learLogsEx change2010 .PS1:1 char:147
+ get-childitem -Path C:\inetpub\logs\LogFiles\w 3svc1 -recurse | where-object {$_.lastwritetime -lt (get-date).addDays(
-365)} | Foreach-Object { del <<<< $_.FullName }
+ CategoryInfo : PermissionDenied: (C:\inetpub\logs...\u_ex13 0118.log:F ileInfo) [Remove-Item], IOExceptio
n
+ FullyQualifiedErrorId : RemoveFileSystemItemUnAuth orizedAcce ss,Microso ft.PowerSh ell.Comman ds.RemoveI temCommand
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\admin> Get-ExecutionPolicy
Unrestricted
PS C:\Users\admin\downloads> .\clearlogsexchange2010.ps
PS C:\Users\admin\downloads> set-executionpolicy unrestricted
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes : Y
PS C:\Users\admin> cd downloads
PS C:\Users\admin\downloads> .\clearlogsexchange2010.ps
Remove-Item : Cannot remove item C:\inetpub\logs\LogFiles\w
tion.
At C:\Users\admin\downloads\C
+ get-childitem -Path C:\inetpub\logs\LogFiles\w
-365)} | Foreach-Object { del <<<< $_.FullName }
+ CategoryInfo : PermissionDenied: (C:\inetpub\logs...\u_ex13
n
+ FullyQualifiedErrorId : RemoveFileSystemItemUnAuth
ASKER
@Hemil
I went to C:\Program Files\Microsoft\Exchange Server\V14\Logging\lodctr_ backups folder and selected all files (dated from 2011 thru 2013) and deleted them. Now the folder is empty.
I wonder why there were not more recent log files in that folder?
I went to C:\Program Files\Microsoft\Exchange Server\V14\Logging\lodctr_
I wonder why there were not more recent log files in that folder?
I have no idea why you didn't see any current.
I mean you should have current logs.
But it doesn't matter through the time will generate more logs automatically. For now you have release space from your HDD.
I mean you should have current logs.
But it doesn't matter through the time will generate more logs automatically. For now you have release space from your HDD.
Read about what that is:
https://technet.microsoft.com/en-us/library/bb490926.aspx
https://technet.microsoft.com/en-us/library/bb490926.aspx
ASKER
"I have no idea why you didn't see any current. I mean you should have current logs. " --> C:\Program Files\Microsoft\Exchange Server\V14\Logging\lodctr_ backups folder seems to contain *.bak files (some type of installation related???). They are not Exchange Transaction log files, if that is what you are trying to say.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I have recommended this question be closed as follows:
Split:
-- Ronin (https:#a42381979)
-- Hemil Aquino (https:#a42382327)
If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.
seth2740
Experts-Exchange Cleanup Volunteer
I have recommended this question be closed as follows:
Split:
-- Ronin (https:#a42381979)
-- Hemil Aquino (https:#a42382327)
If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.
seth2740
Experts-Exchange Cleanup Volunteer
Once you have done the backup, delete the logs. Just leave the current dated ones.
Those logs are transaction logs it wouldn't impact the server.
Also, as @Ronin stated, you can download the script from Microsoft to delete them logs and simplify your administration.