Skip to content

Try out constant_keyword value fields in system log integrations #1211

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

Merged

Conversation

fearful-symmetry
Copy link
Contributor

What does this PR do?

This is a draft PR to test out the changes discussed here: https://github.com/elastic/security-team/issues/780
This is an addition based on the spec changes here: elastic/package-spec#194

This probably won't pass CI or anything now, as we're also waiting for this: elastic/elastic-package#386

This PR adds the value field to constant_keyword fields in the base yaml files.

Checklist

  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • If I'm introducing a new feature, I have modified the Kibana version constraint in my package's manifest.yml file to point to the latest Elastic stack release (e.g. ^7.13.0).

@elasticmachine
Copy link

elasticmachine commented Jun 24, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #1211 updated

  • Start Time: 2021-06-29T16:21:33.555+0000

  • Duration: 11 min 13 sec

  • Commit: 64cac9f

Test stats 🧪

Test Results
Failed 0
Passed 266
Skipped 0
Total 266

Trends 🧪

Image of Build Times

Image of Tests

@peluja1012
Copy link

Hi @fearful-symmetry, thanks for opening up this PR! From the Security Solution side, the most important piece is for this integration to populate both event.dataset and event.module. The idea, as described here, was that integrations, such as this one, could populate values for these fields by defining them as constant_keyword and then setting the value in the index mapping. I'm not too familiar with this codebase, but in this PR I don't see any changes related to event.dataset or event.module. If values for these fields are already being set somewhere else, then we're probably ok. But otherwise, we may need to make other updates here or somewhere else.

@andrewkroh
Copy link
Member

Thanks for setting up a test. I merged support for the value field into Kibana so after we get some new snapshots I expect this should work. elastic/kibana#103000

@fearful-symmetry
Copy link
Contributor Author

Figured I'd get the fields mixed up. Let's try that.

@fearful-symmetry
Copy link
Contributor Author

@andrewkroh do we want to manually set the value for event.dataset or use some kind of alias?

@@ -1,12 +1,22 @@
- name: data_stream.type
type: constant_keyword
description: Data stream type.
value: logs
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a nice addition we likely should add anywhere. @mtojek I remember we had some discussion around this in the past, maybe there is even an issue for it. Later on we should make sure it is in sync with the type in the manifest.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you referring to validation only? If so, then I understand that this property will ALWAYS be in sync with the type (any overriding forbidden)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, can't think of a use case where the two would not be in sync.

- name: data_stream.dataset
type: constant_keyword
description: Data stream dataset.
value: system.auth
- name: event.dataset
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Can we move event.dataset and event.module to the bottom to have it together as one block? Like this the diff is also cleaner to only have an addition on the bottom, assuming we leave out the changes for value in data_stream.*

Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

Please update the changelog and version in the package manifest.

CI complains about formatting and Git conflicts.

@ruflin
Copy link
Contributor

ruflin commented Jun 28, 2021

For reference, here the two related issues: #226 elastic/kibana#66551

value: system.security
- name: event.dataset
type: constant_keyword
description: event dataset.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should be uppercase

- name: event.dataset
type: constant_keyword
description: event dataset.
value: system.security
- name: data_stream.namespace
type: constant_keyword
description: Data stream namespace.
- name: dataset.type
Copy link
Contributor

Choose a reason for hiding this comment

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

@ruflin shouldn't this field be removed?

- name: data_stream.namespace
type: constant_keyword
description: Data stream namespace.
- name: dataset.type
type: constant_keyword
description: Dataset type.
value: logs
- name: dataset.name
Copy link
Contributor

Choose a reason for hiding this comment

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

@ruflin shouldn't this field be removed? I think we replaced it with data_stream

- name: dataset.name
type: constant_keyword
description: Dataset name.
value: system.security
- name: dataset.namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

@ruflin same here

@ycombinator ycombinator removed their request for review June 28, 2021 14:10
@fearful-symmetry fearful-symmetry marked this pull request as ready for review June 28, 2021 15:46
@fearful-symmetry
Copy link
Contributor Author

Alright, everything should be updated now. Just depends on what we want to do with the value in the data_stream objects that I added because I was confused, as well as data_stream.type

@fearful-symmetry
Copy link
Contributor Author

A tad confused by the CI failures, since ep check -v seems happy when I run it locally.

@fearful-symmetry fearful-symmetry requested a review from ruflin June 28, 2021 16:26
@fearful-symmetry
Copy link
Contributor Author

...helps if I update elastic-package

@@ -1,4 +1,9 @@
# newer versions go on top
- version: "0.13.5"
changes:
- description: Use event.datastream and event.module

Choose a reason for hiding this comment

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

Should this say event.dataset instead of event.datastream?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch!

Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

@fearful-symmetry
Copy link
Contributor Author

Could you please make sure that dataset.* are not required anymore and clean them?

@mtojek that's one of the things I'm not clear on. What uses dataset.*? I'm not really sure if it's safe to remove.

@fearful-symmetry
Copy link
Contributor Author

Okay, so it just now occurred to me that when you said "required anymore" you were probably referring to the dashboards & saved searches. If that's the case, no, nothing is using them.

@mtojek mtojek self-requested a review June 29, 2021 08:21
Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

LGTM

@fearful-symmetry fearful-symmetry merged commit 52ae7e3 into elastic:master Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v7.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants