public final class LogsQueryAsyncClient extends Object
Instantiating an asynchronous Logs query Client
LogsQueryAsyncClient logsQueryAsyncClient = new LogsQueryClientBuilder() .credential(tokenCredential) .buildAsyncClient();
Modifier and Type | Method and Description |
---|---|
Mono<LogsQueryResult> |
query(String workspaceId,
String query,
com.azure.core.experimental.models.TimeInterval timeInterval)
Returns all the Azure Monitor logs matching the given query in the specified workspaceId.
|
<T> Mono<List<T>> |
query(String workspaceId,
String query,
com.azure.core.experimental.models.TimeInterval timeInterval,
Class<T> type)
Returns all the Azure Monitor logs matching the given query in the specified workspaceId.
|
<T> Mono<List<T>> |
query(String workspaceId,
String query,
com.azure.core.experimental.models.TimeInterval timeInterval,
Class<T> type,
LogsQueryOptions options) |
Mono<LogsBatchQueryResultCollection> |
queryBatch(LogsBatchQuery logsBatchQuery)
Returns all the Azure Monitor logs matching the given batch of queries.
|
Mono<com.azure.core.http.rest.Response<LogsBatchQueryResultCollection>> |
queryBatchWithResponse(LogsBatchQuery logsBatchQuery)
Returns all the Azure Monitor logs matching the given batch of queries.
|
<T> Mono<com.azure.core.http.rest.Response<List<T>>> |
queryWithResponse(String workspaceId,
String query,
com.azure.core.experimental.models.TimeInterval timeInterval,
Class<T> type,
LogsQueryOptions options)
Returns all the Azure Monitor logs matching the given query in the specified workspaceId.
|
Mono<com.azure.core.http.rest.Response<LogsQueryResult>> |
queryWithResponse(String workspaceId,
String query,
com.azure.core.experimental.models.TimeInterval timeInterval,
LogsQueryOptions options)
Returns all the Azure Monitor logs matching the given query in the specified workspaceId.
|
public Mono<LogsQueryResult> query(String workspaceId, String query, com.azure.core.experimental.models.TimeInterval timeInterval)
Query logs from the last 24 hours
Mono<LogsQueryResult> queryResult = logsQueryAsyncClient.query("{workspace-id}", "{kusto-query}", TimeInterval.LAST_DAY); queryResult.subscribe(result -> { for (LogsTableRow row : result.getTable().getRows()) { System.out.println(row.getRow() .stream() .map(LogsTableCell::getValueAsString) .collect(Collectors.joining(","))); } });
workspaceId
- The workspaceId where the query should be executed.query
- The Kusto query to fetch the logs.timeInterval
- The time period for which the logs should be looked up.public <T> Mono<List<T>> query(String workspaceId, String query, com.azure.core.experimental.models.TimeInterval timeInterval, Class<T> type)
T
- The type the result of this query should be mapped to.workspaceId
- The workspaceId where the query should be executed.query
- The Kusto query to fetch the logs.timeInterval
- The time period for which the logs should be looked up.type
- The type the result of this query should be mapped to.public <T> Mono<List<T>> query(String workspaceId, String query, com.azure.core.experimental.models.TimeInterval timeInterval, Class<T> type, LogsQueryOptions options)
T
- The type the result of this query should be mapped to.workspaceId
- The workspaceId where the query should be executed.query
- The Kusto query to fetch the logs.timeInterval
- The time period for which the logs should be looked up.type
- The type the result of this query should be mapped to.options
- The log query options to configure server timeout, set additional workspaces or enable
statistics and rendering information in response.public Mono<com.azure.core.http.rest.Response<LogsQueryResult>> queryWithResponse(String workspaceId, String query, com.azure.core.experimental.models.TimeInterval timeInterval, LogsQueryOptions options)
Query logs from the last 7 days and set the service timeout to 2 minutes
Mono<Response<LogsQueryResult>> queryResult = logsQueryAsyncClient.queryWithResponse("{workspace-id}", "{kusto-query}", TimeInterval.LAST_7_DAYS, new LogsQueryOptions().setServerTimeout(Duration.ofMinutes(2))); queryResult.subscribe(result -> { for (LogsTableRow row : result.getValue().getTable().getRows()) { System.out.println(row.getRow() .stream() .map(LogsTableCell::getValueAsString) .collect(Collectors.joining(","))); } });
workspaceId
- The workspaceId where the query should be executed.query
- The Kusto query to fetch the logs.timeInterval
- The time period for which the logs should be looked up.options
- The log query options to configure server timeout, set additional workspaces or enable
statistics and rendering information in response.public <T> Mono<com.azure.core.http.rest.Response<List<T>>> queryWithResponse(String workspaceId, String query, com.azure.core.experimental.models.TimeInterval timeInterval, Class<T> type, LogsQueryOptions options)
T
- The type the result of this query should be mapped to.workspaceId
- The workspaceId where the query should be executed.query
- The Kusto query to fetch the logs.timeInterval
- The time period for which the logs should be looked up.type
- The type the result of this query should be mapped to.options
- The log query options to configure server timeout, set additional workspaces or enable
statistics and rendering information in response.public Mono<LogsBatchQueryResultCollection> queryBatch(LogsBatchQuery logsBatchQuery)
Execute a batch of logs queries
LogsBatchQuery batchQuery = new LogsBatchQuery(); String queryId1 = batchQuery.addQuery("{workspace-id-1}", "{kusto-query-1}", TimeInterval.LAST_DAY); String queryId2 = batchQuery.addQuery("{workspace-id-2}", "{kusto-query-2}", TimeInterval.LAST_7_DAYS, new LogsQueryOptions().setServerTimeout(Duration.ofMinutes(2))); Mono<LogsBatchQueryResultCollection> batchQueryResponse = logsQueryAsyncClient.queryBatch(batchQuery); batchQueryResponse.subscribe(result -> { for (LogsBatchQueryResult queryResult : result.getBatchResults()) { System.out.println("Logs query result for query id " + queryResult.getId()); for (LogsTableRow row : queryResult.getTable().getRows()) { System.out.println(row.getRow() .stream() .map(LogsTableCell::getValueAsString) .collect(Collectors.joining(","))); } } });
logsBatchQuery
- LogsBatchQuery
containing a batch of queries.public Mono<com.azure.core.http.rest.Response<LogsBatchQueryResultCollection>> queryBatchWithResponse(LogsBatchQuery logsBatchQuery)
logsBatchQuery
- LogsBatchQuery
containing a batch of queries.Copyright © 2021 Microsoft Corporation. All rights reserved.