Compartilhar via


LogsQueryClient.QueryWorkspaceAsync Método

Definição

Sobrecargas

QueryWorkspaceAsync(String, String, QueryTimeRange, LogsQueryOptions, CancellationToken)

Executa a consulta de logs.

QueryWorkspaceAsync<T>(String, String, QueryTimeRange, LogsQueryOptions, CancellationToken)

Executa a consulta de logs. Desserializa o resultado em uma classe de modelo fortemente tipada ou em um tipo primitivo se a consulta retornar uma única coluna.

Exemplo de consulta de um modelo:

Response<IReadOnlyList<MyLogEntryModel>> response = await client.QueryWorkspaceAsync<MyLogEntryModel>(
    workspaceId,
    "AzureActivity | summarize Count = count() by ResourceGroup | top 10 by Count",
    new QueryTimeRange(TimeSpan.FromDays(1)));

Exemplo de consulta de um primitivo:

Response<IReadOnlyList<string>> response = await client.QueryWorkspaceAsync<string>(
    workspaceId,
    "AzureActivity | summarize Count = count() by ResourceGroup | top 10 by Count | project ResourceGroup",
    new QueryTimeRange(TimeSpan.FromDays(1)));

QueryWorkspaceAsync(String, String, QueryTimeRange, LogsQueryOptions, CancellationToken)

Origem:
LogsQueryClient.cs
Origem:
LogsQueryClient.cs

Executa a consulta de logs.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Query.Models.LogsQueryResult>> QueryWorkspaceAsync (string workspaceId, string query, Azure.Monitor.Query.QueryTimeRange timeRange, Azure.Monitor.Query.LogsQueryOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member QueryWorkspaceAsync : string * string * Azure.Monitor.Query.QueryTimeRange * Azure.Monitor.Query.LogsQueryOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Query.Models.LogsQueryResult>>
override this.QueryWorkspaceAsync : string * string * Azure.Monitor.Query.QueryTimeRange * Azure.Monitor.Query.LogsQueryOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Monitor.Query.Models.LogsQueryResult>>
Public Overridable Function QueryWorkspaceAsync (workspaceId As String, query As String, timeRange As QueryTimeRange, Optional options As LogsQueryOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of LogsQueryResult))

Parâmetros

workspaceId
String

A ID do workspace a ser incluída na consulta (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

query
String

A consulta Kusto para buscar os logs.

timeRange
QueryTimeRange

O período para o qual os logs devem ser pesquisados.

options
LogsQueryOptions

O LogsQueryOptions para configurar a consulta.

cancellationToken
CancellationToken

O CancellationToken a ser usado.

Retornos

O LogsQueryResult com os resultados da consulta.

Comentários

Quando o timeRange argumento é All e o query argumento contém um filtro de intervalo de tempo, o serviço subjacente usa o intervalo de tempo especificado em query.

Aplica-se a

QueryWorkspaceAsync<T>(String, String, QueryTimeRange, LogsQueryOptions, CancellationToken)

Origem:
LogsQueryClient.cs
Origem:
LogsQueryClient.cs

Executa a consulta de logs. Desserializa o resultado em uma classe de modelo fortemente tipada ou em um tipo primitivo se a consulta retornar uma única coluna.

Exemplo de consulta de um modelo:

Response<IReadOnlyList<MyLogEntryModel>> response = await client.QueryWorkspaceAsync<MyLogEntryModel>(
    workspaceId,
    "AzureActivity | summarize Count = count() by ResourceGroup | top 10 by Count",
    new QueryTimeRange(TimeSpan.FromDays(1)));

Exemplo de consulta de um primitivo:

Response<IReadOnlyList<string>> response = await client.QueryWorkspaceAsync<string>(
    workspaceId,
    "AzureActivity | summarize Count = count() by ResourceGroup | top 10 by Count | project ResourceGroup",
    new QueryTimeRange(TimeSpan.FromDays(1)));
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<T>>> QueryWorkspaceAsync<T> (string workspaceId, string query, Azure.Monitor.Query.QueryTimeRange timeRange, Azure.Monitor.Query.LogsQueryOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member QueryWorkspaceAsync : string * string * Azure.Monitor.Query.QueryTimeRange * Azure.Monitor.Query.LogsQueryOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<'T>>>
override this.QueryWorkspaceAsync : string * string * Azure.Monitor.Query.QueryTimeRange * Azure.Monitor.Query.LogsQueryOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<'T>>>
Public Overridable Function QueryWorkspaceAsync(Of T) (workspaceId As String, query As String, timeRange As QueryTimeRange, Optional options As LogsQueryOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of IReadOnlyList(Of T)))

Parâmetros de tipo

T

Parâmetros

workspaceId
String

A ID do workspace a ser incluída na consulta (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

query
String

A consulta Kusto para buscar os logs.

timeRange
QueryTimeRange

O período para o qual os logs devem ser pesquisados.

options
LogsQueryOptions

O LogsQueryOptions para configurar a consulta.

cancellationToken
CancellationToken

O CancellationToken a ser usado.

Retornos

Resultados da consulta mapeados para um tipo T.

Comentários

Quando o timeRange argumento é All e o query argumento contém um filtro de intervalo de tempo, o serviço subjacente usa o intervalo de tempo especificado em query.

Aplica-se a