Windows Azure-清理WADLogsTable [英] Windows Azure - Cleaning Up The WADLogsTable

查看:81
本文介绍了Windows Azure-清理WADLogsTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了有关Windows Azure的DiagnosticMonitor使用的WADLogsTable表是否会自动修剪旧日志条目的有冲突的信息.

I've read conflicting information as to whether or not the WADLogsTable table used by the DiagnosticMonitor in Windows Azure will automatically prune old log entries.

我猜不是,它将永远增长-浪费了我的钱. :)

I'm guessing it doesn't, and will instead grow forever - costing me money. :)

如果是这种情况,那么有人是否有良好的代码示例来说明如何手动清除该表中的旧日志条目?也许基于时间戳?我会定期从辅助角色运行此代码.

If that's the case, does anybody have a good code sample as to how to clear out old log entries from this table manually? Perhaps based on timestamp? I'd run this code from a worker role periodically.

推荐答案

由Windows Azure Diagnostics创建的表中的数据不会自动删除.

The data in tables created by Windows Azure Diagnostics isn't deleted automatically.

但是, Windows Azure PowerShell Cmdlet 包含专门用于这种情况的cmdlet.

However, Windows Azure PowerShell Cmdlets contain cmdlets specifically for this case.

PS D:\>帮助Clear-WindowsAzureLog

PS D:\> help Clear-WindowsAzureLog

NAME Clear-WindowsAzureLog

NAME Clear-WindowsAzureLog

简介 从存储帐户中删除Windows Azure跟踪日志数据.

SYNOPSIS Removes Windows Azure trace log data from a storage account.

语法 Clear-WindowsAzureLog [-DeploymentId] [-从] [-至] [-StorageAccountName] [-StorageAccountKey] [-UseD evelopmentStorage] [-StorageAccountCredentials] []

SYNTAX Clear-WindowsAzureLog [-DeploymentId ] [-From ] [-To ] [-StorageAccountName ] [-StorageAccountKey ] [-UseD evelopmentStorage] [-StorageAccountCredentials ] []

Clear-WindowsAzureLog [-DeploymentId <String>] [-FromUtc <DateTime>] [-ToUt
c <DateTime>] [-StorageAccountName <String>] [-StorageAccountKey <String>]
[-UseDevelopmentStorage] [-StorageAccountCredentials <StorageCredentialsAcc
ountAndKey>] [<CommonParameters>]

您需要指定-ToUtc参数,该日期之前的所有日志都将被删除.

You need to specify -ToUtc parameter, and all logs before that date will be deleted.

如果需要在工作角色中的Azure上执行清理任务,则可以重用C#cmdlet代码. PowerShell Cmdlet是根据许可的MS Public License发布的.

If cleanup task needs to be performed on Azure within the worker role, C# cmdlets code can be reused. PowerShell Cmdlets are published under permissive MS Public License.

基本上,只需要3个文件,而无需其他外部依赖项:DiagnosticsOperationException.cs,WadTableExtensions.cs,WadTableServiceEntity.cs.

Basically, there are only 3 files needed without other external dependencies: DiagnosticsOperationException.cs, WadTableExtensions.cs, WadTableServiceEntity.cs.

这篇关于Windows Azure-清理WADLogsTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆