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 Suricata module to Filebeat #8693

Merged
merged 28 commits into from
Oct 24, 2018
Merged

Add Suricata module to Filebeat #8693

merged 28 commits into from
Oct 24, 2018

Conversation

andrewkroh
Copy link
Member

@andrewkroh andrewkroh commented Oct 23, 2018

This adds a Filebeat module for ingesting the logs created by Suricata IDS/IPS/NSM. The module collects the logs from the Suricata Eve JSON output.

suricata-dashboard

#8153

Mathieu Martin and others added 14 commits October 2, 2018 21:09
This patch updates the packaging scripts to copy modules from
x-pack/filebeat into Elastic-licensed packages.
* Vendorize goimports (#8619)

* Fix make fmt after vendoring goimports (#8623)
This updates the suricata module:

- Added fields from eve.json
- Copy fields of interest into ECS equivalent
- Updated dashboards
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.

Co-authored-by: Adrian Serrano <adrisr83@gmail.com>
Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
Mostly making all vis and searches end in [Suricata].

Part of #8153.
The ingest pipeline for suricata's eve fileset uses the user-agent
plugin. This updates the manifest to include this requirement.
Added Filebeat module test cases for suricata/eve.

To support to running Filebeat module tests from x-pack/filebeat an env var MODULES_PATH was added to allow the existing tests to run against a different module directory than the OSS module dir.

Added some missing fields to pass validation.

Added sample eve.json files for validation.
@andrewkroh andrewkroh added the Filebeat Filebeat label Oct 23, 2018
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.

Needs a changelog.

libbeat/scripts/Makefile Outdated Show resolved Hide resolved

This module comes with a sample dashboard. For example:

TODO: include an image of a sample dashboard
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 docs still have some work to be done. But we can update them in a separate PR. From what I see they are not yet included in the Filebeat docs tree.

Copy link
Member Author

@andrewkroh andrewkroh Oct 23, 2018

Choose a reason for hiding this comment

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

@dedemorton This might be the first documentation for an X-Pack only module. Should I simply link it into the filebeat/docs/module_list.asciidoc?

Copy link
Contributor

Choose a reason for hiding this comment

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

@andrewkroh You should use the x-pack role to flag X-pack features.

[role="xpack"]

Here's an example where we use the flag: https://github.com/elastic/beats/edit/6.4/libbeat/docs/security/securing-beats.asciidoc.

AFAIK modules_list.asciidoc is a generated file, so your module should get added when you run make update.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. That works. I now see the tag.

screen shot 2018-10-23 at 7 24 25 pm

@andrewkroh
Copy link
Member Author

CI is green for this, but there is a Jenkins issue with archiving artifacts from the Filebeat build. I opened a ticket to get some help debugging this on Jenkins.

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

I mainly skimmed through the changes especially didn't check the instrumentation stuff in detail. Overall LGTM.

We should add this to our manual testing checklist.

@@ -54,3 +55,9 @@ The list below covers the major changes between 6.3.0 and master only.
- Set current year in generator templates. {pull}8396[8396]
- You can now override default settings of libbeat by using instance.Settings. {pull}8449[8449]
- Add `-space-id` option to `export_dashboards.go` script to support Kibana Spaces {pull}7942[7942]
- Add `-name` option to `asset.go` script to explicitly name the asset rather than using its filename. {pull}8693[8693]
Copy link
Member

Choose a reason for hiding this comment

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

Was at first surprised by this long dev changelog but it seems all of these actually go into this PR.

#var.paths:

#-------------------------------- Haproxy Module --------------------------------
- module: haproxy
Copy link
Member

Choose a reason for hiding this comment

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

Not related to this PR but I realised we have a bit of inconsistency here related to what we comment out and what not across modules.

@@ -0,0 +1,60 @@
# Suricata module

Shove the content of this repo under `filebeats/module/suricata` for testing,
Copy link
Member

Choose a reason for hiding this comment

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

Still needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll clean this up along with the documentation in a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

I cleaned up this file now. But perhaps you're questioning if we should remove this file entirely?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I put this file in there as a convenience for the handoff. I tend to think that having a bit of a readme this deep down in the module can be helpful to people who will collaborate on this in the future, while not being in the way otherwise. I would leave it in there after a cleanup. I'd probably remove the whole "Caveats" section but leave the getting started tips.

}
, {"convert":
{"field": "suricata.eve.http.hostname"
,"target_field": "url.host.name"
Copy link
Member

Choose a reason for hiding this comment

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

This will be url.hostname in the next days in ECS. @webmat Please correct me if I'm wrong.

We can still adjust this a bug fix if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's imminent indeed: elastic/ecs#147

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.

LGTM

Jenkins is failing during artifact archival. This might fix it.
Jenkins is failing during artifact archival. This might fix it.
Run make fix-permissions on the x-pack/filebeat after executing tests.
The problem was the ownership of files rather than the symlinks.
@andrewkroh andrewkroh merged commit 3e1b03e into master Oct 24, 2018
andrewkroh added a commit to andrewkroh/beats that referenced this pull request Oct 24, 2018
This adds a Filebeat module for ingesting the logs created by Suricata IDS/IPS/NSM. The module collects the logs from the Suricata Eve JSON output (https://suricata.readthedocs.io/en/latest/output/eve/eve-json-format.html). elastic#8153

The module is included in the Elastic licensed Filebeat package. It is considered beta at this stage. It includes two sample dashboards.

It uses Elastic Common Schema (ECS) for field naming were applicable, but it has to work-around the conflict with the existing source field in Filebeat. source_ecs holds the data that goes into the ECS source field. This will be rectified in the next major release when we can make a breaking change.

The development tooling for the building/testing/packaging of x-pack modules is still a bit of a WIP. So at the moment testing and packaging continues to happen through the OSS filebeat directory.

Co-authored-by: Adrian Serrano <adrisr83@gmail.com>
Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
Co-authored-by: Mathieu Martin <mathieu.martin@elastic.co>
Co-authored-by: Tudor Golubenco <tudor@elastic.co>
(cherry picked from commit 3e1b03e)
andrewkroh added a commit that referenced this pull request Oct 24, 2018
* Add Suricata module to Filebeat (#8693)

This adds a Filebeat module for ingesting the logs created by Suricata IDS/IPS/NSM. The module collects the logs from the Suricata Eve JSON output (https://suricata.readthedocs.io/en/latest/output/eve/eve-json-format.html). #8153

The module is included in the Elastic licensed Filebeat package. It is considered beta at this stage. It includes two sample dashboards.

It uses Elastic Common Schema (ECS) for field naming were applicable, but it has to work-around the conflict with the existing source field in Filebeat. source_ecs holds the data that goes into the ECS source field. This will be rectified in the next major release when we can make a breaking change.

The development tooling for the building/testing/packaging of x-pack modules is still a bit of a WIP. So at the moment testing and packaging continues to happen through the OSS filebeat directory.

Co-authored-by: Adrian Serrano <adrisr83@gmail.com>
Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
Co-authored-by: Mathieu Martin <mathieu.martin@elastic.co>
Co-authored-by: Tudor Golubenco <tudor@elastic.co>
(cherry picked from commit 3e1b03e)

* Change url.host.name to url.hostname (#8732)

This update the Filebeat Suricata module to use url.hostname instead of url.host.name.

* Add fields used by Suricata module

Add fields used by Suricata module to fields.yml. Some of these are in ECS.

event.type
destination.ip
destination.port
user_agent.original
user_agent.device
user_agent.version
user_agent.major
user_agent.minor
user_agent.patch
user_agent.name
user_agent.os.name
user_agent.os.full_name (non-ECS)
user_agent.os.version
user_agent.os.major
user_agent.os.minor
file.path
file.size
@andrewkroh andrewkroh deleted the feature-suricata branch February 1, 2019 21:29
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.

6 participants