Skip to content

Commit

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

## Summary

Summarize your PR. If it involves visual changes include a screenshot or
gif.

Adds Cloud Security Telemetry to track all cloud accounts from products
`CSPM`,`KSPM`, and`CNVM`

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
Omolola-Akinleye and kibanamachine authored Oct 4, 2023
1 parent 620ee8d commit fc434d1
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 fc434d1

Please sign in to comment.