Showing posts with label ULS. Show all posts
Showing posts with label ULS. Show all posts

Monday, October 19, 2015

SharePoint correlation IDs don't have to drive you crazy!

I have a serious love / hate relationship with SharePoint correlation IDs. You know - the ones that tell you that there was an error but are otherwise not very informative?

example of SharePoint 2013 Correlation ID
The beauty of Correlation IDs is that it you are given a reference point to track down log entries of relevance. Remember, it's not an error code, it is what it says it is - a correlation ID - a tool to grab related events in the log to get a better picture of why something failed and had to show you an on-screen error message!

You can use a Microsoft's now official (it used to be on CodePlex) Unified Log Service (ULS) Viewer to view the logs and even search by correlation ID, but you can also just fire up a SharePoint enabled PowerShell prompt and use Merge-SPlogfile to get the information faster!

This simple PowerShell cmdlet will allow you to search all the farm servers and find any instances of the correlation ID and show you the issues!
For example, to grab all of the events with the correlation ID in the graphic above and place the results in a text file instead of dumping on screen I would use the following command:

Merge-SPlogfile –Path c:\Mergelog.txt –Correlation 3410f29b-b756-694c-7a574ff74cab


For example, just today I just was getting an error when viewing content based on an external data type and received a correlation ID type error with little information in the error itself.

I ran the above command then opened excel and used the data tab in the ribbon to get external data from a text file and chose Tab Delimited. Then I formatted the results as a table and hid a few columns I'm not interested in.

The results looked like this:
Click to see larger

As you can see, the correlation ID is the same for all results (that's the point) so as I troll through the results I see things like error in the execution of the web part (true) and an Access Denied message from the secure store - and this was my problem, my user account hadn't been mapped to be able to use the secure store target application ID!

Let me know if this worked for you or if you have any questions! Happy searching!

Wednesday, April 30, 2014

Monitoring Settings in SharePoint Central Administration

In the Central Administration UI there are several different options related to monitoring your Farm. It's important to know what goes where, especially for those of you taking the 70-331 exam.

Let's think of it in terms of answering questions!

Video Format:
https://www.youtube.com/watch?v=Z5WG05c09lk

Text Format:


To answer these questions:
  • What errors or information goes into the Trace Logs (Unified Logging Service) and Windows Event Logs?
  • Where are the Trace Logs?
  • How long do I keep Trace Logs? 
  • How large can the Trace Logs be?
  • Is Event Flood Protection enabled?
Open "Configure Diagnostic Logging"

That takes you here:
For more on Diagnostic Logging and Trace Logs look here:
http://majorbacon.blogspot.com/search/label/ULS



To answer these questions:
    • Is Usage Data Collection enabled?
    • What Usage Events am I logging?
    • Where is teh Usage Data Collection Log located?
    • Is Health Data Collection Enabled?
    • What is the Health Data Collection schedule?
    • What is the Log Collection Schedule (the process that retrieves the usage log files and puts them into the database so that they can be processed for reports)
    • What is the Usage and Health Logging Database and Server (and credentials)?
     Open "Configure Usage and Health Data Collection"


     Which will take you here:


    Notice that by default Usage collection is disabled! That is good for performance, but means that you are not tracking any Web Analytics - how our system is actually being used.

    What if you want to change your SQL server or database? Never fear, it just has to be done in PowerShell:
    Set-SPUsageApplication -DatabaseServer <DatabaseServerName> -DatabaseName <DatabaseName>

    You can quickly enable or disable usage logging using PowerShell too:
     Set-SPUsageService -LoggingEnabled 1|0

    To answer the questions:
      • What are my slowest pages?
        (assuming you have already enabled usage and health data collection)
      • Who are my top active users?
       Open "View Health Reports"

      Which will take you here:


      To answer the questions:
      • What kind of bandwidth is being used?
      • What kind of File IO am I experiencing?
      • Where is all my usage and health data?
       Open "View Administrative Reports"

      Which will take you here:

      To answer the questions:
        • What SharePoint Errors in Security, Performance, or Configuration are available to detect?
        • Is a particular Rule Enabled and Schedule Correctly?
        • Will a Rule attempt to fix a problem automatically?

        Open "Review Rule Definitions"


        Which opens this:
        Which lists each Health Analyzer Rule which you can edit to manage the schedule and enabled aspects like this:

        To answer the question:

        • What Security, Configuration, or Performance Health Rules is SharePoint wanting to notify me of?


        Open "Review Problems and Solutions"

        Which will open this:

        You can open a problem to view the issue and potential solutions, and after fixing you can Reanalyze to remove the item from the list of problems




        To answer the questions:

        • What SharePoint timer jobs (like scheduled tasks) are enabled/disabled?
        • What is a job's schedule?
        • Where do I go to manually start a scheduled job?

        Open "Review Job Definitions"


         Which will take you here:


        Note the important filtering options to see service or web application specific jobs

        Select a job to view the job detail, manage the schedule, or run immediately.

        Finally,
        To answer the questions:

          • What jobs are scheduled
          • What jobs are running
          • What jobs have errored?

          Open "Check Job Status"


           Which will open the list of Timer Jobs with relevant lings to what is Schedule, Running, and the Job History of success or failure in the past:



          Well gang, I hope this clears up some of the questions you might have here in the Monitoring section of SharePoint Central Administration

          Correctly configuring the Diagnostic Levels in SharePoint 2013

          When things aren't going right and you post your problem to the forums, what do they always say? Check the logs! That's because you can use SharePoint 2013 Unified Logging Service (ULS) logs when troubleshooting. But... there are a lot of ways to configure those logs and for the 70-331 exam and the real world, you will want to take a look at some best practices:

          Change where the server writes logs.
          By default, SharePoint 2013 writes diagnostic logs to the installation directory, ie "%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\15\Logs"
          Logs take space, and it would be pretty awful if you were resolving a SharePoint issue by enabling more logging only to cause additional problems because of your logging! Therefore, we should configure logging to write to a different drive by using the following PowerShell command:

          Set-SPDiagnosticConfig -LogLocation <PathToNewLocation>


          Note: The location that you specify must be a valid location on all servers in the server farm, and watch out for slow connections to network disk paths, especially if you enable verbose-level logging

          Define a maximum for log disk space usage.
          How much of your disk will the logs use? Imagine Sesame Street's Cookie Monster is the ULS logging service and your disk is a cookie. ULS logging in unrestricted by default in disk consumption. So the best practice is to restrict the disk space that logging uses, especially in verbose-level logging situations, so that when reaching maximum defined capacity the ULS service will remove the oldest logs before it recording new log data.
          Configure logging restrictions using the following PowerShell commands:
          Set-SPDiagnosticConfig -LogMaxDiskSpaceUsageEnabled
          Set-SPDiagnosticConfig -LogDiskSpaceUsageGB <UsageInGB>


          These two settings can be done in central administration in "Configure Diagnostic logging" settings
          Also, don't forget that you can enable Event Flood Protection to suppress repeated events from overflowing a log that is configured to be circular

          Set-SPDiagnosticConfig -EventLogFloodProtectionEnabled





          Choose your ULS logging levels carefully, especially Verbose
          Also called "event throttling" this is where you choose the depth of data collection for the ULS (trace logs) and the event logs. The Trace Log levels are described below.

          Typical Production settings will max out at collecting Medium Logging. Minimum Logging would be "Unexpected" Maximum Logging is Verbose which records every action, quickly eating drive space. Use verbose-level logging to record detail when making critical changes and then reset to a lower logging level.


          Similar precautions need to be taken for the Event Logging Levels:


          To Set Event Throttling use Diagnostic Logging in Central Administration or the PowerShell cmdlets:
          To set all levels:
          Set-SPLogLevel -EventSeverity <level>
          Set-SPLogLevel -TraceSeverity <level>

          To set both for one category you could use the following
          Set-SPLogLevel -EventSeverity <level> -TraceSeverity <level> -Identity "<category>"

          For example:
          Set-SPLogLevel -EventSeverity warning -TraceSeverity high -Identity "Search"
           



          Regularly back up logs.
          Diagnostic logs contain important data. Therefore, back up the logs regularly to ensure that this data is preserved. Use your backup software against the log directory.

          Read the Logs:
          Viewing the Logs: You can use Windows PowerShell to filter the data, display it in various ways, and output the data to a data grid with which you can filter, sort, group, and export data to Excel 2013.

          Get all the logs: (tmi!)

          Get-SPLogEvent

          Get filtered Log info: 

          Get-SPLogEvent | Where-Object {$_.<eventcolumn> -eq "value"}

          By area:
          Where-Object {$_.Area -eq "SharePoint Foundation"}


          By level:
          Where-Object {$_.Level -eq "Information" }


          By category:
          Where-Object {$_.Category -eq "Monitoring"}


          Search for text:
          Where-Object {$_.Message -like "people"}


          Output to a graphical grid - use the filtered search then pass results to out-gridview cmdlet
          Get-SPLogEvent | Where-Object {$_.Area -eq "Search"} | Out-GridView



          Of course you could also download the ULS viewer from codeplex to aid in viewing logs. More info on that here: 
          http://majorbacon.blogspot.com/search/label/ULS

          Happy Logging!
           

          Thursday, April 3, 2014

          SharePoint is trying to tell you something. Use the ULS viewer to find out what!

          Unified Logging Service in SharePoint is great, but you need a way to view the logs. Enter ULS Viewer - a free tool you can download from Microsoft CodePlex in order to debug a SharePoint environment. Keep in mind that it can only log what it receives, so when you have networking problems or even IIS problems that come before SharePoint, your ULS logs won't have much to tell you. But when you've just deployed a new feature or web app and now your having a meltdown, you should definitely take a look using this tool. And the features!
          • View multiple SharePoint log files at once
          • Search by any field
          • Filter the log by any field
          • File drag & drop support
          • Live monitoring for entire farm
          • Export filtered log entries
          • Bookmark log entries
          • Get popup notification of SharePoint log events from system tray
          • Receive email notifications on errors
          • Redirect log entries to event log
          • Supports SharePoint 2007, 2010 and 2013
          System Requirements:
          • .NET Framework 3.5
          • Windows XP or above
          Download the ULS Viewer here: Download ULS Viewer
          You will probably want to launch the tool as an admin.
          Open the Viewer and from the file menu choose "Open From", then "ULS":


          You can reference the default SharePoint ULS logs location or an alternate location:





          The Logs will show you what is going in the mind of SharePoint. You can filter to "Show High Messages" which will reference ony high priority errors