Skip to content

Commit

Permalink
[OsQuery] fix usage collector when .fleet indices are empty (#102977) (
Browse files Browse the repository at this point in the history
…#103058)

Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
  • Loading branch information
kibanamachine and nchaulet committed Jun 23, 2021
1 parent 0dafcb0 commit 227e5bb
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 227e5bb

Please sign in to comment.