RoleInstanceDiagnosticManager.BeginOnDemandTransfer Method (DataBufferName, OnDemandTransferOptions)

 

Begins an on-demand transfer of the specified data buffer with the specified options.

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

public Guid BeginOnDemandTransfer(
	DataBufferName sourceBufferName,
	OnDemandTransferOptions onDemandTransferOptions
)

Return Value

Type: System.Guid

Type: System.Guid

A request ID identifying the transfer.

The BeginOnDemandTransfer method is used to start an on-demand transfer of buffered diagnostic data from the local storage of a role instance to the storage account.

The first input parameter, sourceBufferName, indicates the value of the DataBufferName enumeration that you want to transfer. The second input parameter, onDemandTransferOptions, is an OnDemandTransferOptions object that contains configuration options for the on-demand transfer.

Only one transfer of each data buffer can be enqueued at a time for each instance of a role. You cannot queue multiple transfers. If you want to queue a new transfer for a particular data buffer, you must first cancel the current transfer by calling the EndOnDemandTransfer method or CancelOnDemandTransfers method.

If you have specified a NotificationQueueName value, a completion notification will be sent to the queue.

Example

The following code snippet starts an on-demand transfer of Windows event logs for the role instance:

// Get the diagnostic monitor for the specified role instance.
RoleInstanceDiagnosticManager roleInstanceDiagnosticManager = 
         new RoleInstanceDiagnosticManager(myStorageAccount, 
                                           "28281fc7754b44faa9ccf4911983edf1",
                                           "MyWebRole",
                                           "deployment(1).MyAzureProject.WebRole1.0");

// Specify the on-demand transfer options for the diagnostic data.
OnDemandTransferOptions transferOptions = new OnDemandTransferOptions();

// Get data starting from an hour ago until now.
transferOptions.From = DateTime.UtcNow.AddHours(1.0);
transferOptions.To = DateTime.UtcNow;

// Specify only error-level logs.
transferOptions.LogLevelFilter = LogLevel.Error;

// Provide a name for the queue where completion messages will be stored.
transferOptions.NotificationQueueName = "wad-on-demand-transfers";

// Start a transfer of Windows event logs.
roleInstanceDiagnosticManager.BeginOnDemandTransfer(DataBufferName.WindowsEventLogs, transferOptions);

System_CAPS_warningWarning

This API is not supported in Azure SDK versions 2.5 and higher. Instead, use the diagnostics.wadcfg XML configuration file. For more information, see Collect Logging Data by Using Azure Diagnostics.

Return to top
Show: