Skip to content

Commit

Permalink
[8.11] [Cloud Security][Telemetry] Create a unified cloud accounts co…
Browse files Browse the repository at this point in the history
…llector (#167203) (#168050)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Cloud Security][Telemetry] Create a unified cloud accounts collector
(#167203)](#167203)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Lola","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-04T22:26:49Z","message":"[Cloud
Security][Telemetry] Create a unified cloud accounts collector
(#167203)\n\n## Summary\r\n\r\nSummarize your PR. If it involves visual
changes include a screenshot or\r\ngif.\r\n\r\nAdds Cloud Security
Telemetry to track all cloud accounts from products\r\n`CSPM`,`KSPM`,
and`CNVM`\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"fc434d185dfbdac8061aa2c344fb03013f462c9d","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Cloud
Security","v8.11.0","v8.12.0"],"number":167203,"url":"https://github.com/elastic/kibana/pull/167203","mergeCommit":{"message":"[Cloud
Security][Telemetry] Create a unified cloud accounts collector
(#167203)\n\n## Summary\r\n\r\nSummarize your PR. If it involves visual
changes include a screenshot or\r\ngif.\r\n\r\nAdds Cloud Security
Telemetry to track all cloud accounts from products\r\n`CSPM`,`KSPM`,
and`CNVM`\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"fc434d185dfbdac8061aa2c344fb03013f462c9d"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/167203","number":167203,"mergeCommit":{"message":"[Cloud
Security][Telemetry] Create a unified cloud accounts collector
(#167203)\n\n## Summary\r\n\r\nSummarize your PR. If it involves visual
changes include a screenshot or\r\ngif.\r\n\r\nAdds Cloud Security
Telemetry to track all cloud accounts from products\r\n`CSPM`,`KSPM`,
and`CNVM`\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"fc434d185dfbdac8061aa2c344fb03013f462c9d"}}]}]
BACKPORT-->

Co-authored-by: Lola <[email protected]>
  • Loading branch information
kibanamachine and Omolola-Akinleye authored Oct 5, 2023
1 parent 379cbda commit 6a19c59
Show file tree
Hide file tree
Showing 9 changed files with 699 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const getIdentifierRuntimeMapping = (): MappingRuntimeFields => ({
!doc["rule.benchmark.posture_type"].empty;
def orchestratorIdAvailable = doc.containsKey("orchestrator.cluster.id") &&
!doc["orchestrator.cluster.id"].empty;
if (!postureTypeAvailable) {
def identifier = orchestratorIdAvailable ?
doc["orchestrator.cluster.id"].value : doc["cluster_id"].value;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';

export const getPackagePolicyIdRuntimeMapping = (): MappingRuntimeFields => ({
package_policy_identifier: {
type: 'keyword',
script: {
source: `
def packagePolicyIdAvailable = doc.containsKey("cloud_security_posture.package_policy.id") &&
!doc["cloud_security_posture.package_policy.id"].empty;
if (packagePolicyIdAvailable) {
emit(doc["cloud_security_posture.package_policy.id"].value);
}
`,
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const getSafeKspmClusterIdRuntimeMapping = (): MappingRuntimeFields => ({
!doc["orchestrator.cluster.id"].empty;
def clusterIdAvailable = doc.containsKey("cluster_id") &&
!doc["cluster_id"].empty;
if (orchestratorIdAvailable) {
emit(doc["orchestrator.cluster.id"].value);
} else if (clusterIdAvailable) {
Expand Down
Loading

0 comments on commit 6a19c59

Please sign in to comment.