Skip to content

Commit

Permalink
[OsQuery] fix usage collector when .fleet indices are empty
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet committed Jun 22, 2021
1 parent b9f64b7 commit b988a06
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions x-pack/plugins/osquery/server/usage/fetchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export async function getPolicyLevelUsage(
},
},
index: '.fleet-agents',
ignore_unavailable: true,
});
const policied = agentResponse.body.aggregations?.policied as AggregationsSingleBucketAggregate;
if (policied && typeof policied.doc_count === 'number') {
Expand Down Expand Up @@ -117,6 +118,7 @@ export async function getLiveQueryUsage(
},
},
index: '.fleet-actions',
ignore_unavailable: true,
});
const result: LiveQueryUsage = {
session: await getRouteMetric(soClient, 'live_query'),
Expand Down Expand Up @@ -185,6 +187,7 @@ export async function getBeatUsage(esClient: ElasticsearchClient) {
},
},
index: METRICS_INDICES,
ignore_unavailable: true,
});
const lastDayAggs = metricResponse.aggregations?.lastDay as AggregationsSingleBucketAggregate;
const result: BeatMetricsUsage = {
Expand Down

0 comments on commit b988a06

Please sign in to comment.