Keep Log folder in Exchange 2010

Exchange Log FileExchange Log File 2Hi,
 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.
LVL 1
sgleeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RoninCommented:
You can get rid of those, ideally use the following script.
Also I recommend following this approach, which will allow you clean up all the old unneeded files.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hemil AquinoNetwork EngineerCommented:
As I always says, before do anything create a full backup. Some times small little things can make our whole work a misery.
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.
sgleeAuthor Commented:
@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.
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Hemil AquinoNetwork EngineerCommented:
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.!
sgleeAuthor Commented:
@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\w3svc1 -recurse | where-object {$_.lastwritetime -lt
(get-date).addDays(-365)} | Foreach-Object { del $_.FullName }
Remove-Item : Cannot remove item C:\inetpub\logs\LogFiles\w3svc1\u_ex130118.log: Not Enough permission to perform opera
tion.
At line:1 char:147
+ get-childitem -Path C:\inetpub\logs\LogFiles\w3svc1 -recurse | where-object {$_.lastwritetime -lt (get-date).addDays(
-365)} | Foreach-Object { del <<<<  $_.FullName }
    + CategoryInfo          : PermissionDenied: (C:\inetpub\logs...\u_ex130118.log:FileInfo) [Remove-Item], IOExceptio
   n
    + FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
RoninCommented:
First you need to allow execution of scripts on the system.
To view current permission level, execute:
Get-ExecutionPoliocy

Open in new window

Note the output.
Next, run regular PS as Administrator and set the execution policy to Unrestricted.
Set-ExecutionPolicy Unrestricted 

Open in new window

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.
sgleeAuthor Commented:
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.PS1 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.ps1
Remove-Item : Cannot remove item C:\inetpub\logs\LogFiles\w3svc1\u_ex130118.log: Not Enough permission to perform operation.
RoninCommented:
It should read: Get-ExecutionPolicy and not Get-ExecutionPiolicy

Right-click on regular PS icon, not EMS, Run as Administrator
Set-ExecutionPolicy Unrestricted

Open in new window

Navigate to the location of the script, c:\temp as an example in the same PS window.
Run the script.
Hemil AquinoNetwork EngineerCommented:
Wouldn't be better if you go to the directory and delete them?
Is the same thing.
sgleeAuthor Commented:
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.ps1

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.ps1
Remove-Item : Cannot remove item C:\inetpub\logs\LogFiles\w3svc1\u_ex130118.log: Not Enough permission to perform opera
tion.
At C:\Users\admin\downloads\ClearLogsExchange2010.PS1:1 char:147
+ get-childitem -Path C:\inetpub\logs\LogFiles\w3svc1 -recurse | where-object {$_.lastwritetime -lt (get-date).addDays(
-365)} | Foreach-Object { del <<<<  $_.FullName }
    + CategoryInfo          : PermissionDenied: (C:\inetpub\logs...\u_ex130118.log:FileInfo) [Remove-Item], IOExceptio
   n
    + FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
Hemil AquinoNetwork EngineerCommented:
Go to the directory physically, if you can't delete then do the follows:

1- Right click to the folder properties.
2- Security tab
3- add user full permission, either your local user or administrator.

If it does work then go to advance and change the ownership, see my example below.
Folder.png
sgleeAuthor Commented:
@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?
Hemil AquinoNetwork EngineerCommented:
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.
RoninCommented:
sgleeAuthor Commented:
"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.
Hemil AquinoNetwork EngineerCommented:
Let me give you a brief description about this folder before I give you an stright up answer

The Exchange folder Logging\lodctr_backups, always held lot's of data that would affect your HDD performance which is utterly unnecessary to run Exchange. Now those files are created for use by the lodctr program  and what it does is registers new Performance of the server.

For example: When you do recovery of your system from certain dates, those logs has information about what happened to the system hardware and database. Another folder that has influence is the one that the database has with the logs " folder name MAILBOX" I think, you will see lots of logs by date getting bigger every day.

Those folders always creates log files that decrease the capacity of your HDD.

Now the Loggin\lodctr are backups from logs of the system. I haven't dealt with those logs for a log time but what I usually do it's back it up and deleted afterwards. And of course when I see my HDD is getting low in space.

So, in your case you dont need to worry, you will see them back.
Last time I cleared my logs was like 2 months ago and I tell you everything runs fine.

But, dont hesitate to always have your backup before doing anything that you haven't tried.
That's my advice.
Seth SimmonsSr. Systems AdministratorCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.