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

Update security service integrations packages mappings #12624

Open
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

mrodm
Copy link
Contributor

@mrodm mrodm commented Feb 5, 2025

Proposed commit message

Updated failed mappings found in system tests while validating the documents based on mappings in the data-streams and the corresponding transforms.

Example of Buildkite build where the failures are raised: https://buildkite.com/elastic/integrations/builds/20794

Packages updated here:

  • box_events
[0] field "threat.enrichments.indicator.first_seen" is undefined: actual mapping type (keyword) does not match with ECS definition type: date
[1] field "threat.enrichments.indicator.last_seen" is undefined: actual mapping type (keyword) does not match with ECS definition type: date
  • claroty_ctd
[0] field "threat.indicator.modified_at" is undefined: actual mapping type (keyword) does not match with ECS definition type: date
  • crowdstrike
[0] field "crowdstrike.assessments.analytics_and_improvements_mac" is undefined: field definition not found
[1] field "crowdstrike.assessments.application_firewall_mac" is undefined: field definition not found
[2] field "crowdstrike.assessments.crendential_dumping_hash_mac" is undefined: field definition not found
...
  • mimecast
[0] field "threat.indicator.first_seen" is undefined: actual mapping type (keyword) does not match with ECS definition type: date
[1] field "threat.indicator.modified_at" is undefined: actual mapping type (keyword) does not match with ECS definition type: date
  • sublime_security
[0] field "sublime_security.email_message.headers.hops.fields.position" is undefined: field definition not found
  • ti_anomali
[0] field "threat.indicator.modified_at" is undefined: actual mapping type (keyword) does not match with ECS definition type: date
Packages with changes related to transforms moved to #12841
  • github (transforms)
field "message" is undefined: actual mapping type (keyword) does not match with ECS definition type: match_only_text
  • ti_custom (transforms)
[0] field "threat.indicator.url.original" is undefined: actual mapping type (keyword) does not match with ECS definition type: wildcard
  • tychon (transforms)
[0] field "related.ip" is undefined: actual mapping type (keyword) does not match with ECS definition type: ip
[1] field "server.ip" is undefined: actual mapping type (keyword) does not match with ECS definition type: ip
  • wiz (transforms)
[0] field "ecs.version" is undefined: actual mapping type (text) does not match with ECS definition type: keyword
[1] field "message" is undefined: actual mapping type (text) does not match with ECS definition type: match_only_text

[0] field "device.id" is undefined: actual mapping type (text) does not match with ECS definition type: keyword
[1] field "ecs.version" is undefined: actual mapping type (text) does not match with ECS definition type: keyword
[2] field "message" is undefined: actual mapping type (text) does not match with ECS definition type: match_only_text
[3] field "related.ip" is undefined: actual mapping type (text) does not match with ECS definition type: ip
[4] field "tags" is undefined: actual mapping type (text) does not match with ECS definition type: keyword
[5] field "vulnerability.reference" is undefined: actual mapping type (text) does not match with ECS definition type: keyword
Teleport changes moved to #12851
  • teleport (ingest pipeline event-groups)
[0] field "teleport.audit.account_id" is undefined: field definition not found
[1] field "teleport.audit.aws_host" is undefined: field definition not found
[2] field "teleport.audit.aws_region" is undefined: field definition not found
[3] field "teleport.audit.aws_service" is undefined: field definition not found
[4] field "teleport.audit.exit_code" is undefined: field definition not found
[5] field "teleport.audit.instance_id" is undefined: field definition not found
[6] field "teleport.audit.region" is undefined: field definition not found
[7] field "teleport.audit.status" is undefined: field definition not found
[8] field "teleport.audit.target" is undefined: field definition not found

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

Author's Checklist

  • Add changelog entries for all the updated packages
  • Test with elastic-package enabled mappings https://buildkite.com/elastic/integrations/builds/21924
  • Is it required to update transform settings (destination index)?
  • Remove debug changes .buildkite folder and go.mod/go.sum files.
  • Remove unnecessary comments from package files.

How to test this PR locally

Run elastic-package with mappings validation enabled and run system tests:

cd packages/<package>
elastic-package stack up -v -d --version <kibana_constraint>
export ELASTIC_PACKAGE_FIELD_VALIDATION_TEST_METHOD=mappings
# Add defer-cleanup to check the data ingested in the corresponding indices/data streams
elastic-package test system -v --defer-cleanup 900s

elastic-package stack down -v

Related issues

@mrodm mrodm self-assigned this Feb 5, 2025
@elastic-vault-github-plugin-prod
Copy link

elastic-vault-github-plugin-prod bot commented Feb 5, 2025

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@mrodm mrodm force-pushed the update_security-service-integrations_packages_mappings branch from 8ddd8ff to 1469158 Compare February 6, 2025 13:01
@@ -10,7 +10,7 @@ source:
# that ability in order to prevent having duplicate data and prevent query
# time field type conflicts.
dest:
index: "logs-github_latest.dest_code_scanning-1"
index: "logs-github_latest.dest_code_scanning-2"
Copy link
Contributor Author

@mrodm mrodm Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a new field definition is added to a transform, should this destination index be updated (increment suffix number)? Or keep that destination index without changes?

Same doubt for the other packages updating field definitions in transforms (tychon and wiz).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @kcreddy

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We increment the index to avoid any conflicts due to mapping changes.
I also simulated an integration upgrade from keyword to match_only_text on same index. After the upgrade, the type remained to be keyword and didn't change to match_only_text.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I guess this would mean that the destination index must be updated, am I right ? @kcreddy

In the other transforms (from other packages), there are changes related to field definitions with changes in mappings like:

  • keyword to ip
  • text to ip
  • text to keyword
  • text to match_only_text
  • keyword to wildcard
  • keyword to match_only_text

Should we update also the destination index there?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I guess this would mean that the destination index must be updated, am I right ?

@mrodm, yes the destination index version has to be updated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've bumped the version defined in the fleet_transform_version setting for all the transforms that I've modified here @kcreddy

Comment on lines 33 to 34
- name: ecs.version
external: ecs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: field "ecs.version" is undefined: actual mapping type (text) does not match with ECS definition type: keyword

This change ensures that ecs.version is set as keyword.

Comment on lines 31 to 32
- name: message
external: ecs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: field "message" is undefined: actual mapping type (text) does not match with ECS definition type: match_only_text

This change ensures that message is set as match_only_text.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same query as above.

Comment on lines 9 to 10
- name: device.id
external: ecs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: field "device.id" is undefined: actual mapping type (text) does not match with ECS definition type: keyword

This change ensures that device.id is mapped as keyword.

Comment on lines 19 to 20
- name: vulnerability.reference
external: ecs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: field "vulnerability.reference" is undefined: actual mapping type (text) does not match with ECS definition type: keyword

This change ensures that vulnerability.reference is mapped as keyword.

Comment on lines 43 to 44
- name: tags
external: ecs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: field "tags" is undefined: actual mapping type (text) does not match with ECS definition type: keyword

This change ensures that tags is mapped as keyword.

@mrodm
Copy link
Contributor Author

mrodm commented Feb 18, 2025

I was wondering if it would be worth to move all the changes related to transforms to another Pull Request so all the other packages can be updated (exception for teleport), WDYT ? @jsoriano @efd6
I'm not sure if there are any concerns related to the changes applied in the transforms here in this PR (e.g. this one #12624 (comment))

With the latest changes applied in elastic-package, validations in transforms are not going to be checked for now. The changes in those transforms were applied in this PR to take advantage of fixing them since they were detected here in this Buildkite build (https://buildkite.com/elastic/integrations/builds/20794).

@efd6
Copy link
Contributor

efd6 commented Feb 18, 2025

I was wondering if it would be worth to move all the changes related to transforms to another Pull Request so all the other packages can be updated (exception for teleport), WDYT ?

That wouldn't make me unhappy.

@mrodm
Copy link
Contributor Author

mrodm commented Feb 19, 2025

I was wondering if it would be worth to move all the changes related to transforms to another Pull Request so all the other packages can be updated (exception for teleport), WDYT ?

That wouldn't make me unhappy.

The changes of the packages that were updating transform field definitions have been moved to #12841 (github, ti_custom, tychon and wiz). I've tried to keep links to the previous discussions.

Updated the description accordingly.

@mrodm mrodm requested a review from efd6 February 19, 2025 18:16
Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after clarification of nits.

.buildkite/scripts/common.sh Outdated Show resolved Hide resolved
go.mod Show resolved Hide resolved
@mrodm
Copy link
Contributor Author

mrodm commented Feb 20, 2025

Moved teleport changes to #12851

@elasticmachine
Copy link

💚 Build Succeeded

History

cc @mrodm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants