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

Set event.category and event.kind for Suricata #10882

Merged

Conversation

andrewkroh
Copy link
Member

Set event.category: network_traffic. And conditionally set event.kind based on the event_type field. Use alert for suricata alerts and event for everything else.

Also skip geoip if the event has already been enriched (like if the data went through Logstash first).

@elasticmachine
Copy link
Collaborator

Pinging @elastic/secops

@andrewkroh andrewkroh force-pushed the feature/fb/suricata-event-kind-category branch from aea3464 to 4c380a7 Compare February 22, 2019 00:11
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.

LGTM

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.

Good improvement for geoip 👍

I think we should make sure we don't categorize Suricata stats at all, if we're not ready, or perhaps go with my suggestion below.

x-pack/filebeat/module/suricata/eve/ingest/pipeline.json Outdated Show resolved Hide resolved
"value": "event"
"script": {
"lang": "painless",
"source": "def t = ctx.suricata?.eve?.event_type; if (t == \"stats\") {\n ctx['event']['kind'] = \"metric\";\n} else if (t == \"alert\") {\n ctx['event']['kind'] = \"alert\";\n ctx['event']['category'] = \"network_traffic\";\n} else {\n ctx['event']['kind'] = \"event\";\n ctx['event']['category'] = \"network_traffic\";\n}"
}
Copy link
Member Author

Choose a reason for hiding this comment

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

For the reviewers sake, this is what the code looked like before I made it JSON.

  - script:
      lang: painless
      source: >-
        def t = ctx.suricata?.eve?.event_type;
        if (t == "stats") {
          ctx['event']['kind'] = "metric";
        } else if (t == "alert") {
          ctx['event']['kind'] = "alert";
          ctx['event']['category'] = "network_traffic";
        } else {
          ctx['event']['kind'] = "event";
          ctx['event']['category'] = "network_traffic";
        }

@@ -194,7 +199,7 @@
"ecs.version": "1.0.0-beta2",
"event.dataset": "suricata.eve",
"event.end": "2018-07-05T19:51:23.009Z",
"event.kind": "event",
"event.kind": "metric",
"event.module": "suricata",
Copy link
Member Author

Choose a reason for hiding this comment

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

@webmat This is metric now. 👍

Set `event.category: network_traffic`. And conditionally set event.kind based on the `event_type` field. Use `alert` for suricata alerts and `event` for everything else.

Also skip geoip if the event has already been enriched (like if the data went through Logstash first).
@andrewkroh andrewkroh force-pushed the feature/fb/suricata-event-kind-category branch from 77521f1 to f3b893d Compare February 23, 2019 01:52
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

Thanks for the adjustment :-)

@andrewkroh andrewkroh merged commit d6172c2 into elastic:master Feb 25, 2019
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.

4 participants