你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

LogsQueryClient class

Azure Log Analytics 客户端

构造函数

LogsQueryClient(TokenCredential, LogsQueryClientOptions)

构造可用于使用 Log Analytics 查询语言查询日志的 LogsClient。

方法

queryBatch(QueryBatch[], LogsQueryBatchOptions)

在批处理中查询包含多个查询的日志。

queryResource(string, string, QueryTimeInterval, LogsQueryOptions)

对 Azure 资源执行 Kusto 查询

queryWorkspace(string, string, QueryTimeInterval, LogsQueryOptions)

查询 Log Analytics 工作区中的日志。

构造函数详细信息

LogsQueryClient(TokenCredential, LogsQueryClientOptions)

构造可用于使用 Log Analytics 查询语言查询日志的 LogsClient。

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

参数

tokenCredential
TokenCredential

令牌凭据。

options
LogsQueryClientOptions

LogsClient 的选项。

方法详细信息

queryBatch(QueryBatch[], LogsQueryBatchOptions)

在批处理中查询包含多个查询的日志。

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

参数

batch

QueryBatch[]

要执行的一批 Kusto 查询。 可以将每个查询配置为针对单独的工作区运行。

options
LogsQueryBatchOptions

用于在批处理中查询日志的选项。

返回

所有查询的日志查询结果。

queryResource(string, string, QueryTimeInterval, LogsQueryOptions)

对 Azure 资源执行 Kusto 查询

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

参数

resourceId

string

资源的标识符。 预期格式为“/subscriptions/<sid>/resourceGroups/<rg>/providers/<providerName>/<resourceType/>resourceName<>”。

query

string

Kusto 查询。 详细了解 Kusto query syntax <https://docs.microsoft.com/azure/data-explorer/kusto/query/>

timespan
QueryTimeInterval

要查询数据的时间跨度。 这是ISO8601时间段值。 除了在查询表达式中指定的任何时间跨度外,还会应用此时间跨度。 可以在 Durations 对象中找到一些常见持续时间。

options
LogsQueryOptions

用于调整请求的各个方面的选项。

返回

Promise<LogsQueryResult>

返回与给定 Kusto 查询匹配的 Azure 资源的所有 Azure Monitor 日志。

queryWorkspace(string, string, QueryTimeInterval, LogsQueryOptions)

查询 Log Analytics 工作区中的日志。

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

参数

workspaceId

string

Log Analytics 工作区的“工作区 ID”

query

string

Kusto 查询。

timespan
QueryTimeInterval

要查询数据的时间跨度。 这是ISO8601时间段值。 除了在查询表达式中指定的任何时间跨度外,还会应用此时间跨度。 可以在 Durations 对象中找到一些常见持续时间。

options
LogsQueryOptions

用于调整请求的各个方面的选项。

返回

Promise<LogsQueryResult>

查询结果。