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

Add ecs.version to each event #9284

Merged
merged 4 commits into from
Dec 28, 2018
Merged

Add ecs.version to each event #9284

merged 4 commits into from
Dec 28, 2018

Conversation

ruflin
Copy link
Collaborator

@ruflin ruflin commented Nov 29, 2018

This indicates with each event which ECS version is used. Currently it is all based on ecs 1.0.0-beta1. We must make sure to keep this value up-to-date.

Removes event.version as does not exist anymore.

@ruflin
Copy link
Collaborator Author

ruflin commented Nov 29, 2018

@urso For awareness

@ruflin ruflin mentioned this pull request Nov 29, 2018
@webmat
Copy link
Contributor

webmat commented Dec 4, 2018

I'm not entirely convinced we should populate this field automatically for all Beats.

I agree the field definition should be global. But the value should be populated (or not) per Beat. It needs to be an explicit statement made per Beat, with no default value. This ensure that someone made that decision to update the value, and presumably made sure that the change was accurate.

@webmat webmat self-requested a review December 4, 2018 02:29
Copy link
Contributor

@webmat webmat left a comment

Choose a reason for hiding this comment

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

I'm not 100% sure what the scope of the code in module.go is. If it sets the value for the field for all Beats, I think we should revert it.

The rest of the changes LGTM, however.

@ruflin
Copy link
Collaborator Author

ruflin commented Dec 4, 2018

It does set the field for all Beats. Do you see a problem with that?

@ruflin ruflin force-pushed the ecs-version branch 2 times, most recently from e7831c2 to 1b13e22 Compare December 12, 2018 07:54
@webmat
Copy link
Contributor

webmat commented Dec 12, 2018

@ruflin: It does set the field for all Beats. Do you see a problem with that?

Yes, I'd rather have each Beat have the duty to define this explicitly. This would represent more of a conscious statement that a given Beat actually is compliant to, or following a specific version of ECS.

Setting it as a default globally incurs the risk of just slipping in -- below the radar -- and not being reviewed consistently.

If we follow the approach I'm proposing, I'd review any PR setting or changing the value of a Beat for ecs.version by actually reviewing the fields as produced by this Beat, and rejecting the PR as long as there are conflicts with the listed version of ECS.

Right now, if we set this field globally, there's nothing to "reject", if a given Beat is doing things that don't conform to ECS.

@ruflin
Copy link
Collaborator Author

ruflin commented Dec 13, 2018

I don't think it will make a difference from if the ecs.version field is there or not. A Beat can't conflict with ECS definitions as each beat has the ECS fields defined and it's checked in CI that new fields do not conflict with these. Even if we add a field foo in Beats but it could be mapped to source.ip that does not mean we are not compatible with ECS.

Copy link
Contributor

@webmat webmat left a comment

Choose a reason for hiding this comment

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

I'm not worried about additional fields. They are indeed allowed, of course.

What I'm worried about is the more subtle ways not to follow ECS. Examples of this would be: using reserved fields, using ECS fields incorrectly, not following guidelines to do some data duplication (e.g. related.*, src/dst => cli/srv).

I get the feeling we're going to get bit by the fact that none of the Beats makes a conscious and specific statement that they do follow a certain version. This is a thing I would wish to have not only now, for the introduction of ECS, but also in the future, with every subsequent ECS release.

Perhaps I'm imagining a problem where there isn't one, though. If you think this is fine, we can move forward and refine this later, if we feel the need.

@ruflin
Copy link
Collaborator Author

ruflin commented Dec 14, 2018

I think there are 2 things here: Following recommendations and following ECS. Following ECS for me is having the fields and not conflicting with it. Copies to related etc. are good to have but if not done does not mean it is not using ECS. If we follow the logic that an event can only have ecs.version set if it follows 100% of the recommendation of ECS, this field would never be used.

For me this field means: There are not conflicts with ECS and ECS is used in as many place as possible, but there might be additional fields. This is based on our Guidelines here: https://github.com/elastic/ecs#implementing-ecs

@webmat
Copy link
Contributor

webmat commented Dec 14, 2018

@ruflin Yeah I'm good to proceed 👍

@ruflin ruflin requested a review from a team as a code owner December 17, 2018 08:18
@ruflin ruflin force-pushed the ecs-version branch 2 times, most recently from 7439924 to 1bf9874 Compare December 21, 2018 13:24
@ruflin ruflin force-pushed the ecs-version branch 2 times, most recently from 730f539 to 3f6c281 Compare December 27, 2018 10:06
This indicates with each event which ECS version is used. Currently it is all based on ecs 1.0.0-beta1. We must make sure to keep this value up-to-date.

Removes event.version as does not exist anymore.
"event.dataset": "eve",
"event.module": "suricata",
"event.type": "alert",
"http.request.method": "GET",
"http.response.status_code": "200",
"input.type": "log",
"log.offset": 7630,
"source.ip": "192.168.1.146",
"source.port": 37742,
"source.ip": "192.168.1.146",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ycombinator Interesting, this now also happens in my PRs that spaces are added?!?

@ruflin ruflin merged commit b11b355 into elastic:master Dec 28, 2018
@@ -88,6 +88,9 @@ func Load(
"host": common.MapStr{
"name": name,
},
"ecs": common.MapStr{
"version": "1.0.0-beta2",
Copy link
Member

Choose a reason for hiding this comment

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

Just a thought, if we vendor the generated ECS Go package we could rely on that package’s constant (ecs.Version) for keep this value in sync. If you update the fields data you should also be updating the vendored ecs package.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Interesting idea. To take this one step further would be nice to have a fields.go as part of this package that we could use too so no need to modify the ecs-fields.yml. This would assume that the global fields.yml is generated by export fields instead of collection in the future.

@ruflin ruflin deleted the ecs-version branch January 7, 2019 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants