16

I want to read ULS logs for my sharepoint online server.

Is there any standard way of doing it ?

2
  • 4
    You can't - ULS logs live on the server file systems and you don't have any access to the SharePoint Online servers. This is like asking for the Apache logs for your WordPress.com hosted blog.
    – James Love
    Commented Jun 5, 2013 at 10:34
  • Very unlikely Microsoft will add this but they are considering alternative approaches for retrieving information for developers to debug SharePoint Online. Check this Yammer post by Vesa Juvonen (Microsoft) requesting community feedback "Purpose of this is to collect input on understanding what is actually needed, so if we will not provide access to ULS, we would provide needed information by using alternative routes" yammer.com/itpronetwork/#/Threads/show?threadId=628700722 Commented Mar 8, 2016 at 10:52

4 Answers 4

9

Apparently you can do it using Windows PowerShell for SharePoint Online cmdlets

http://technet.microsoft.com/en-us/library/fp161379.aspx

1
  • 2
    This one does not answer the question at all. The commandlet allows you to read the errors generated within the App if the code is using the standard App logging technique, but certainly it does not allow you to read all of the ULS logs for the tenant.
    – Roman
    Commented Aug 30, 2015 at 8:06
7

You can send the support desk a copy of the correlation ID, it takes a week or two on average from what my sys admins have told me (They put in all our requests). You will either get the log lines, a translation of what happened or be told it is internal.

Source [link may become outdated when post is archived]: http://community.office365.com/en-us/forums/148/t/155804.aspx

UPDATE As above Microsoft have added this functionality since this question was asked. This functionality is not yet complete however.

2
  • link is not working any more
    – netadictos
    Commented Oct 23, 2018 at 10:17
  • The post is archived now it seems, the pertinent information is still in the answer
    – Hugh Wood
    Commented Oct 24, 2018 at 11:57
3

Office App Model Samples come with a library for getting ULS logs out of SharePoint Online - http://www.vrdmn.com/2014/03/view-tenant-uls-logs-in-sharepoint.html

Here's the sample code that is on Vardhaman Deshpande's blog, in case it's gone at some point:

namespace ViewSPOLog
{
    class Program
    {
        static void Main(string[] args)
        {
            //Open the Tenant Administration Context with the Tenant Admin Url
            using (var tenantContext = new ClientContext("https://yoursite-admin.sharepoint.com/"))
            {
                //Authenticate with a Tenant Administrator
                var passWord = new SecureString();
                foreach (char c in "password".ToCharArray()) passWord.AppendChar(c);
                tenantContext.Credentials = new SharePointOnlineCredentials("[email protected]", passWord);

                var tenant = new Tenant(tenantContext);

                var tenantLog = new TenantLog(tenantContext);

                var dateTimeUTCNow = DateTime.UtcNow;

                //Get 50 Rows of Tenant Log Entries starting from 5 days ago till now.
                var logEntries = tenantLog.GetEntries(dateTimeUTCNow.AddDays(-5), dateTimeUTCNow, 50);

                //Get 50 Rows of Tenant Log Entries of the specified CorrelationId starting from 5 days ago till now
                //var logEntries = tenantLog.GetEntriesByCorrelationId(dateTimeUTCNow.AddDays(-5), dateTimeUTCNow, 50, new Guid("ae2b1e34-12eb-4652-a0db-ce4ab916c74e"));

                //Get 50 Rows of Tenant Log Entries of the specified Source starting from 5 days ago till now.
                //var logEntries = tenantLog.GetEntriesBySource(dateTimeUTCNow.AddDays(-5), dateTimeUTCNow, 50, 1);

                //Get 50 Rows of Tenant Log Entries of the specified User starting from 5 days ago till now.
                //var logEntries = tenantLog.GetEntriesByUser(dateTimeUTCNow.AddDays(-5), dateTimeUTCNow, 50, "[email protected]");

                tenantContext.Load(logEntries);

                tenantContext.ExecuteQuery();

                foreach (TenantLogEntry logEntry in logEntries)
                {
                    Console.WriteLine(string.Format("Timestamp:{0} | Message:{1} | CorrelationId:{2} | Source:{3} | User:{4} | CategoryId:{5}",
                        logEntry.TimestampUtc, logEntry.Message, logEntry.CorrelationId , logEntry.Source , logEntry.User, logEntry.CategoryId)); 
                }

                Console.WriteLine("Press Any Key to Exit...");
                Console.ReadKey();
            }
        }
    }
}
2
3

There is no way to do it anymore. The answers above may have worked previously, but Microsoft changed that so you need to contact them to get the required information. The best way will be to contact Microsoft Support.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.