Azure存储服务日志

时间:2015-01-16 12:36:08

标签: azure azure-storage azure-storage-blobs

我是Azure的初学者,需要一些帮助。我们在Azure存储服务方面遇到了一些问题,无法继续。

好了,现在问题是

http://blogs.msdn.com/b/windowsazurestorage/archive/2014/08/05/microsoft-azure-storage-service-version-removal.aspx

总结一下: 我们必须检查/所有blob,表,队列的日志版本,以防它们中的任何一个使用一组计划删除。我已在天蓝门户网站上启用了web应用程序的日志记录。我能够看到

下的三个服务

的https://.blob.core.windows.net

的https://.table.core.windows.net

的https://.queue.core.windows.net

现在在下面的文章中我收集到我们得到的日志格式,因为它们包含一个版本,但没有指定从哪里找到日志以及如何收集日志。我尝试使用https://.blob.core.windows.net/$logs做了不同的事情,但没有任何区别。

所需的日志应采用此格式(样本)

以下是一个示例日志条目,其中突出显示了使用的版本 - 在这种情况下,请求是一个匿名的GetBlob请求,该请求隐式使用了2009-09-19版本:

1.0; 2011-08-09T18:52:40.9241789Z; GetBlob; AnonymousSuccess; 200; 18; 10; anonymous ;; myaccount; blob;“https:// myaccount.blob.core.windows.net/thumbnails/ ?lake.jpg超时= 30000 “;”/我的账户/缩略图/ lake.jpg“; a84aa705-8a85-48c5-B064-b43bd22979c3; 0; 123.100.2.10; 2009-09-19; 252; 0; 265; 100; 0 ;;;“0x8CE1B6EA95033D5”;周五,09-Aug-11 18:52:40 GMT ;;;;“8/9/2011 6:52:40 PM ba98eb12-700b-4d53-9230-33a3330571fc”

您能告诉我一种查看这些日志的方法吗?有什么工具可以使用?

1 个答案:

答案 0 :(得分:4)

由于这些日志存储在名为$logs的blob容器中,因此任何支持从此Blob容器查看数据的存储资源管理器都可用于查看内容。据我所知,以下工具支持从此容器查看数据:Azure Storage Explorer,Cerebrata Azure Management Studio,Cloud Portam(披露:我是使用此工具的开发人员)。

但是,在您可以查看数据之前,您需要启用存储帐户的登录。只有在存储帐户上启用了日志记录后,您才会看到此容器显示在您的存储帐户中。要启用日志记录,您可以再次使用Azure Management Studio或Cloud Portam,也可以使用下面的代码(我在下面提到的代码假定您拥有最新版本的Storage Client Library):

    static void SetLoggingProperties()
    {
        CloudStorageAccount account = new CloudStorageAccount(new StorageCredentials(StorageAccount, StorageAccountKey), true);
        LoggingProperties properties = new LoggingProperties()
        {
            LoggingOperations = LoggingOperations.All,
            RetentionDays = 365,
            Version = "1.0",
        };
        ServiceProperties serviceProperties = new ServiceProperties()
        {
            Cors = null,
            HourMetrics = null,
            MinuteMetrics = null,
            Logging = properties,
        };
        var blobClient = account.CreateCloudBlobClient();
        blobClient.SetServiceProperties(serviceProperties);
        var tableClient = account.CreateCloudTableClient();
        tableClient.SetServiceProperties(serviceProperties);
        var queueClient = account.CreateCloudQueueClient();
        queueClient.SetServiceProperties(serviceProperties);
    }

设置日志记录属性后,请给它一些时间来显示日志。