Export (0) Print
Expand All

DiagnosticDataBufferConfiguration.ScheduledTransferPeriod Property

Updated: April 22, 2013

Gets or sets the interval between scheduled transfers for this data buffer, in minutes.

Namespace: Microsoft.WindowsAzure.Diagnostics
Assembly: Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)

public TimeSpan ScheduledTransferPeriod { get; set; }

Property Value

Type: System.TimeSpan

Returns TimeSpan.

The ScheduledTransferPeriod property is used to set how frequently a data buffer will transfer local logging data to persistent storage. By default, this property is not set for any data buffer to prevent unintentional storage costs.

The value you set for this property will be rounded up to the nearest minute. Therefore, the minimum transfer period you can specify is 1 minute.

Example

The following code snippet remotely sets the transfer period of a Windows event log buffer to 30 minutes on all instances of a specific role.

// Get the connection string. It's recommended that you store the connection string in your web.config or app.config file.
// Use the ConfigurationManager type to retrieve your storage connection string.  You can find the account name and key in
// the Windows Azure Management Portal (http://manage.windowsazure.com).
//string connectionString = "DefaultEndpointsProtocol=https;AccountName=<AccountName>;AccountKey=<AccountKey>";
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString;

// The deployment ID and role name for your application can be obtained from the 
// Windows Azure Management Portal (http://manage.windowsazure.com). See your 
// application dashboard under Cloud Services.
string deploymentID = "e2ab8b6667644666ba627bdf6f5e4daa";
string roleName = "WebRole1";

// Get the DeploymentDiagnosticManager object for your deployment.
DeploymentDiagnosticManager diagManager = new DeploymentDiagnosticManager(connectionString, deploymentID);

// Get the RoleInstanceDiagnosticManager objects for each instance of your role.
IEnumerable<RoleInstanceDiagnosticManager> instanceManagers = diagManager.GetRoleInstanceDiagnosticManagersForRole(roleName);

// Iterate through the role instances and update the configuration.
foreach (RoleInstanceDiagnosticManager roleInstance in instanceManagers)
{
   DiagnosticMonitorConfiguration diagnosticConfiguration = roleInstance.GetCurrentConfiguration();

   // Filter the logs so that only error-level logs are transferred to persistent storage.
   diagnosticConfiguration.WindowsEventLog.ScheduledTransferLogLevelFilter = LogLevel.Error;

   // Schedule a transfer period of 30 minutes.
   diagnosticConfiguration.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(30.0);

   roleInstance.SetCurrentConfiguration(diagnosticConfiguration);
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows 7 and Windows Server 2008

Target Platforms

Community Additions

ADD
Show:
© 2014 Microsoft