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

Filebeat X-Pack Module Packaging #8615

Merged
merged 11 commits into from
Oct 17, 2018

Conversation

andrewkroh
Copy link
Member

This PR adds an intermediate solution for packaging X-Pack modules with Filebeat. In this PR the dashboards, configuration files, and fields are generated in x-pack/filebeat. Packaging is still done entirely from the OSS filebeat directory by making the build run mage update in x-pack/filebeat then customizing the packaging configuration to point to different dashboards, config, and fields.yml for the Elastic licensed packages.

Long term we will build, test, and package the OSS and Elastic licensed Beats from their respective directories, but this gives us a smaller step in order to be able to release the X-Pack content before the build system is fully transitioned.

x-pack/filebeat/magefile.go Show resolved Hide resolved
dev-tools/mage/fields.go Show resolved Hide resolved
dev-tools/mage/fields.go Show resolved Hide resolved
dev-tools/mage/config.go Show resolved Hide resolved
Copy link
Member Author

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

@adriansr Can you please take over here for me since I'm on PTO this week? Thanks 💯x 💯

I have given you permissions in GH to push write to my repo if you want to go that route or you can close this and work from your own fork (any means is good with me).

@@ -158,7 +169,17 @@ func customizePackaging() {
if args.Spec.License == "Elastic License" {
mods = moduleXPack
modsD = modulesDXPack

// TODO: Replace files with X-Pack versions for:
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the one TODO that needs to be resolved.

andrewkroh and others added 8 commits October 16, 2018 17:38
This PR adds an intermediate solution for packaging X-Pack modules with Filebeat. In this PR the dashboards, configuration files, and fields are generated in x-pack/filebeat. Packaging is still done entirely from the OSS filebeat directory by making the build run `mage update` in x-pack/filebeat then customizing the packaging configuration to point to different dashboards, config, and fields.yml for the Elastic licensed packages.

Long term we will build, test, and package the OSS and Elastic licensed Beats from their respective directories, but this gives us a smaller step in order to be able to release the X-Pack content before the build system is fully transitioned.
X-pack and OSS binaries need a different include/assets.go to account
for fields on non-oss modules.
x-pack/filebeat/include/list.go imported suricata module to have it
register its fields, but this is unnecessary in filebeat as it uses one
big fields.go with all modules fields.
It was not properly replacing the beat binary with the x-pack version.
@@ -39,7 +39,7 @@ func CrossBuild() error {

// Fields generates a fields.yml and fields.go for each module.
func Fields() {
mg.Deps(fieldsYML, mage.GenerateModuleFieldsGo)
mg.Deps(fieldsYML, mage.GenerateAllInOneFieldsGo)
Copy link
Member Author

Choose a reason for hiding this comment

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

The reason I did it this way was because I assumed that all the field content from OSS filebeat was going to be registered through its “all in one” fields.go so then non-OSS filebeat only needed to register its modules’ fields content. This is similar to what metricbeat is doing.

I just wanted to give some context. So if this is working for you then go your route.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation.

What happened is that during my testing, the suricata fields were missing from the x-pack binary. That lead me to make those changes to the fields generation.

In the end this was caused by a mistake in the darwin/tar.gz package description fixed in 620b3778

I'm reverting all the changes to the fields generation.

Copy link
Member Author

Choose a reason for hiding this comment

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

That issue you found is #8549. So we can mark that issue as fixed too once this merges.

Problems with x-pack fields missing were caused by a mistake in the
packaging templates that caused the oss binary to be used for
darwin/tar.gz package.

In order to fix this issue a few unnecessary changes to the fields.yml
generation were carried out.
Copy link
Member Author

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@adriansr adriansr left a comment

Choose a reason for hiding this comment

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

Your changes LGTM @andrewkroh

@adriansr adriansr merged commit 69cce4c into elastic:feature-suricata Oct 17, 2018
@andrewkroh andrewkroh deleted the feature-suricata-pkg branch November 8, 2018 20:22
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