Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's SharePoint Admin Blog > Posts > Move your SharePoint 2010 logs off of your C drive
January 02
Move your SharePoint 2010 logs off of your C drive

Today is the 2nd of January, and prime time to look at New Year’s Resolutions, or as I like to think of them, a list of things I’ll do for two, maybe three days tops, then forget all about for 363 (or in this case, 364) days. Losing weight is one of the more common ones. Since we all know none of us is actually going to stick with that (I type as I eat some Christmas fudge) I propose we do some other shrinking, reducing the space SharePoint takes on the C drive of your server. For production SharePoint 2010 servers, the C drive should be at least 80 GB, and this blog post doesn’t change that. However, we shouldn’t waste it. When I do SharePoint 2010 installs I always recommend to my customers that they have a secondary drive. That drive serves a few purposes, and one of them is to serve as a place to store stuff you can move off of your C drive. SharePoint’s logs are a great candidate for that. A couple of years ago I blogged how to do this for SharePoint 2007. Today’s post is how to do it for SharePoint 2010.

There are two sets of logs you want to move, the diagnostic logs and the usage logs. An important note is that every machine in the farm must have the same paths for this to work. If one doesn’t have a D drive or something SharePoint will freak out.

Here are the steps:

Diagnostic logs:

Central Admin > Monitoring > Configure Diagnostic Logging (/_admin/metrics.aspx). The setting is the “Trace Log” path at the bottom. I strongly recommend only changing the drive letter. Leave the path alone. It’ll make it easier for you to find things later on.  You can also use PowerShell to change this. The cmdlet is Set-SPDiagnosticConfig and the parameter is –LogLocation.

image

With PowerShell:

Set-SPDiagnosticConfig -LogLocation "E:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS”

Usage logs:

Central Admin > Monitoring > Configure web analytics and health data collection (/_admin/LogUsage.aspx). The setting is the “Log file location” setting. Set it to the same path you did the Trace Log above. Again, don’t get fancy and put it at something like “D:\SharePoint\Stuff\Things\LogsAreHiddenHere” The PowerShell cmdlet to alter this is Set-SPUsageService and the parameter is –UsageLogLocation.

image

With PowerShell:

Set-SPUsageService -UsageLogLocation "E:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS\"

How it looks:

image

Your disk savings won’t be crazy big, but every little bit counts. By way of comparison the Logs folder on this web server is taking up 3 GB:

SNAGHTML1809708

The Usage logs get removed once they’re parsed and the Trace logs in that directory go back to 12/19/2011. Your server will certainly have more traffic than mine does, so your logs will probably be larger.

Now, back to that fudge. It’s not going to eat itself, after all.

tk

Comments

Location of moved log files

Great post Todd.  I have moved the SP log files, but chose to change the path to just SharePointLogs on the root of D.  Could you elaborate on why you strongly suggest keeping the origin folder structure?
 on 1/2/2012 3:29 PM

Re: Location of moved log files

It makes them easier to find for you and anyone else trying to troubleshoot your servers. Also anything you read is going to assume that location, so it will make it easier to follow stuff other people write.

tk
Todd O. KlindtNo presence information on 1/2/2012 4:52 PM

Help your admin with a note

TK, great post, I always move the logs (including the IIS Logs) and the Search Index. I then go back to the original LOG directory and put a text file in there called "Hey I Moved the LOGS.txt" and in that file I put the directories where I moved the logs.
 on 1/12/2012 9:05 AM

Re: Help your admin with a note

That's a good idea. I like it.

tk
Todd O. KlindtNo presence information on 1/12/2012 9:39 AM

nice one

thanks
 on 1/3/2013 8:20 AM

SharePoint Log Files growing large on Web Servers only

SharePoint Log Files growing large on Web Servers, IIS Logs files large for one web app

SP Log - 1GB file (each) --> became unusable (can't open)
IIS Log - 3GB (total size for a day)

Can we cap the size of the SharePoint Logs so that it can be open easily

Thank you
Husain
babuth64@gmail.com
 on 3/25/2013 3:25 PM

Re: SharePoint Log Files growing large on Web Servers only

Hi Husain,
It sounds like you have something spewing a lot of events in your logs. The first thing I'd do is see if there is a logging category set to "Verbose." You can do that in Central Admin in the same place this blog post covers. You can also reduce the log interval By default you get a new log file every 30 minutes. Maybe set that to something like 5 or 10 minutes until you figure out why your logs are so large. You can change that interval with Set-SPDiagnosticConfig using the -LogCutInterval parameter.

tk
Todd O. KlindtNo presence information on 3/26/2013 10:18 PM

Usage data doesn't move into database after changing the path

Hi Todd,
I have changed the location for both log and usage file and SP is writing the log files into new location.

But after changing the path, Microsoft SharePoint Foundation Usage Data Import Timer job is not moving the usage data into Usage Database. I can see .usage files in the new location which are more than an hour old.

Do you have any suggession?
Regards,
Mazhar
mazharbd@gmail.com
 on 6/12/2013 10:58 PM

Awesome! Thanks

Very good post.
 on 10/3/2013 9:58 AM

Re: Awesome! Thanks

Good deal. Glad you like it.

tk
Todd O. KlindtNo presence information on 10/3/2013 10:04 AM
1 - 10Next

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person

Twitter


Want a message when I reply to your comment? Put your Twitter handle here.

Attachments

 

 Please Support my Sponsors