LogsQueryClient class

Client for Azure Log Analytics

Constructors

LogsQueryClient(TokenCredential, LogsQueryClientOptions)

Construct a LogsClient that can be used to query logs using the Log Analytics Query language.

Methods

queryBatch(QueryBatch[], LogsQueryBatchOptions)

Query Logs with multiple queries, in a batch.

queryResource(string, string, QueryTimeInterval, LogsQueryOptions)

Executes a Kusto query on an Azure resource

queryWorkspace(string, string, QueryTimeInterval, LogsQueryOptions)

Queries logs in a Log Analytics Workspace.

Constructor Details

LogsQueryClient(TokenCredential, LogsQueryClientOptions)

Construct a LogsClient that can be used to query logs using the Log Analytics Query language.

new LogsQueryClient(tokenCredential: TokenCredential, options?: LogsQueryClientOptions)

Parameters

tokenCredential
TokenCredential

A token credential.

options
LogsQueryClientOptions

Options for the LogsClient.

Method Details

queryBatch(QueryBatch[], LogsQueryBatchOptions)

Query Logs with multiple queries, in a batch.

function queryBatch(batch: QueryBatch[], options?: LogsQueryBatchOptions): Promise<LogsQueryBatchResult>

Parameters

batch

QueryBatch[]

A batch of Kusto queries to execute. Each query can be configured to run against separate workspaces.

options
LogsQueryBatchOptions

Options for querying logs in a batch.

Returns

The Logs query results for all the queries.

queryResource(string, string, QueryTimeInterval, LogsQueryOptions)

Executes a Kusto query on an Azure resource

function queryResource(resourceId: string, query: string, timespan: QueryTimeInterval, options?: LogsQueryOptions): Promise<LogsQueryResult>

Parameters

resourceId

string

The identifier of the resource. The expected format is '/subscriptions//resourceGroups//providers///'.

query

string

A Kusto query. Learn more about the Kusto query syntax <https://docs.microsoft.com/azure/data-explorer/kusto/query/>.

timespan
QueryTimeInterval

The timespan over which to query data. This is an ISO8601 time period value. This timespan is applied in addition to any that are specified in the query expression. Some common durations can be found in the Durations object.

options
LogsQueryOptions

Options to adjust various aspects of the request.

Returns

Promise<LogsQueryResult>

Returns all the Azure Monitor logs matching the given Kusto query for an Azure resource.

queryWorkspace(string, string, QueryTimeInterval, LogsQueryOptions)

Queries logs in a Log Analytics Workspace.

function queryWorkspace(workspaceId: string, query: string, timespan: QueryTimeInterval, options?: LogsQueryOptions): Promise<LogsQueryResult>

Parameters

workspaceId

string

The 'Workspace Id' for the Log Analytics Workspace

query

string

A Kusto query.

timespan
QueryTimeInterval

The timespan over which to query data. This is an ISO8601 time period value. This timespan is applied in addition to any that are specified in the query expression. Some common durations can be found in the Durations object.

options
LogsQueryOptions

Options to adjust various aspects of the request.

Returns

Promise<LogsQueryResult>

The result of the query.