Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reponse Ops][Alerting] Excluding ECS experimental fields from ECS component template #170571

Merged
merged 15 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,64 @@ import { EcsMetadata, FieldMap } from './types';

const EXCLUDED_TYPES = ['constant_keyword'];

// ECS fields that have reached Stage 2 in the RFC process
// are included in the generated Yaml but are still considered
// experimental. Some are correctly marked as beta but most are
// not.

// More about the RFC stages here: https://elastic.github.io/ecs/stages.html

// The following RFCS are currently in stage 2:
// https://github.com/elastic/ecs/blob/main/rfcs/text/0027-faas-fields.md
// https://github.com/elastic/ecs/blob/main/rfcs/text/0035-tty-output.md
// https://github.com/elastic/ecs/blob/main/rfcs/text/0037-host-metrics.md
// https://github.com/elastic/ecs/blob/main/rfcs/text/0040-volume-device.md

// Fields from these RFCs that are not already in the ECS component template
// as of 8.11 are manually identified as experimental below.
// The next time this list is updated, we should check the above list of RFCs to
// see if any have moved to Stage 3 and remove them from the list and check if
// there are any new stage 2 RFCs with fields we should exclude as experimental.

const EXPERIMENTAL_FIELDS = [
'faas.trigger', // this was previously mapped as nested but changed to object
'faas.trigger.request_id',
'faas.trigger.type',
'host.cpu.system.norm.pct',
'host.cpu.user.norm.pct',
'host.fsstats.total_size.total',
'host.fsstats.total_size.used',
'host.fsstats.total_size.used.pct',
'host.load.norm.1',
'host.load.norm.5',
'host.load.norm.15',
'host.memory.actual.used.bytes',
'host.memory.actual.used.pct',
'host.memory.total',
'process.io.bytes',
'volume.bus_type',
'volume.default_access',
'volume.device_name',
'volume.device_type',
'volume.dos_name',
'volume.file_system_type',
'volume.mount_name',
'volume.nt_name',
'volume.product_id',
'volume.product_name',
'volume.removable',
'volume.serial_number',
'volume.size',
'volume.vendor_id',
'volume.vendor_name',
'volume.writable',
];

export const ecsFieldMap: FieldMap = Object.fromEntries(
Object.entries(EcsFlat)
.filter(([_, value]) => !EXCLUDED_TYPES.includes(value.type))
.filter(
([key, value]) => !EXCLUDED_TYPES.includes(value.type) && !EXPERIMENTAL_FIELDS.includes(key)
)
.map(([key, _]) => {
const value: EcsMetadata = EcsFlat[key as keyof typeof EcsFlat];
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ const EcsOptional = rt.partial({
'faas.execution': schemaString,
'faas.id': schemaString,
'faas.name': schemaString,
'faas.trigger': schemaUnknown,
'faas.version': schemaString,
'file.accessed': schemaDate,
'file.attributes': schemaStringArray,
Expand Down
Loading