LogsBatchQuery Class

Definition

Represents a batch that consists of multiple log queries.

public class LogsBatchQuery
type LogsBatchQuery = class
Public Class LogsBatchQuery
Inheritance
System.Object
LogsBatchQuery

Constructors

LogsBatchQuery()

Initializes a new instance of LogsBatchQuery.

Methods

AddQuery(String, String, DateTimeRange, LogsQueryOptions)

Adds the specified query to the batch. Results can be retrieved after the query is submitted via the QueryBatchAsync(LogsBatchQuery, CancellationToken) call.

string countQueryId = batch.AddQuery(
    workspaceId,
    "AzureActivity | count",
    new DateTimeRange(TimeSpan.FromDays(1)));
string topQueryId = batch.AddQuery(
    workspaceId,
    "AzureActivity | summarize Count = count() by ResourceGroup | top 10 by Count",
    new DateTimeRange(TimeSpan.FromDays(1)));

Response<LogsBatchQueryResults> response = await client.QueryBatchAsync(batch);

var count = response.Value.GetResult<int>(countQueryId).Single();
var topEntries = response.Value.GetResult<MyLogEntryModel>(topQueryId);

Applies to