-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create module for NetFlow to add geoip (#10877)
This creates a module around the Filebeat netflow input in order to enrich the events with source.geo.* and destination.geo.* fields by using the geoip processor in Elasticsearch Ingest Node. Usage: ``` filebeat.modules: - module: netflow log: enabled: true var: netflow_host: 0.0.0.0 netflow_port: 2055 ```
- Loading branch information
1 parent
9cf89da
commit 59a05ed
Showing
14 changed files
with
265 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[[filebeat-module-netflow]] | ||
[role="xpack"] | ||
|
||
:modulename: netflow | ||
:has-dashboards: false | ||
|
||
== NetFlow module | ||
|
||
This is a module for receiving NetFlow and IPFIX flow records over UDP. This | ||
input supports NetFlow versions 1, 5, 6, 7, 8 and 9, as well as IPFIX. For | ||
NetFlow versions older than 9, fields are mapped automatically to NetFlow v9. | ||
|
||
This module wraps the <<filebeat-input-netflow,netflow input>> to enrich the | ||
flow records with geolocation information about the IP endpoints by using | ||
Elasticsearch Ingest Node. | ||
|
||
[float] | ||
=== Compatibility | ||
|
||
This module requires the {elasticsearch-plugins}/ingest-geoip.html[ingest-geoip] | ||
Elasticsearch plugins. | ||
|
||
include::../include/running-modules.asciidoc[] | ||
|
||
include::../include/configuring-intro.asciidoc[] | ||
|
||
:fileset_ex: log | ||
|
||
include::../include/config-option-intro.asciidoc[] | ||
|
||
[float] | ||
==== `log` fileset settings | ||
|
||
The fileset is by default configured to listen for UDP traffic on | ||
`localhost:2055`. For most uses cases you will want to set the `netflow_host` | ||
variable to allow the input bind to all interfaces so that it can receive | ||
traffic from network devices. | ||
|
||
["source","yaml",subs="attributes"] | ||
----- | ||
- module: netflow | ||
log: | ||
enabled: true | ||
var: | ||
netflow_host: 0.0.0.0 | ||
netflow_port: 2055 | ||
----- | ||
|
||
`var.netflow_host`:: Address to find to. Defaults to `localhost`. | ||
|
||
`var.netflow_port`:: Port to listen on. Defaults to `2055`. | ||
|
||
`var.max_message_size`:: The maximum size of the message received over UDP. | ||
The default is `10KiB`. | ||
|
||
`var.expiration_timeout`:: The time before an idle session or unused template is | ||
expired. Only applicable to v9 and IPFIX protocols. A value of zero disables | ||
expiration. | ||
|
||
`var.queue_size`:: The maximum number of packets that can be queued for | ||
processing. Use this setting to avoid packet-loss when dealing with occasional | ||
bursts of traffic. | ||
|
||
:has-dashboards!: | ||
|
||
:fileset_ex!: | ||
|
||
:modulename!: | ||
|
||
|
||
[float] | ||
=== Fields | ||
|
||
For a description of each field in the module, see the | ||
<<exported-fields-netflow,exported fields>> section. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- module: netflow | ||
log: | ||
enabled: true | ||
var: | ||
netflow_host: localhost | ||
netflow_port: 2055 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
[role="xpack"] | ||
|
||
:modulename: netflow | ||
:has-dashboards: false | ||
|
||
== NetFlow module | ||
|
||
This is a module for receiving NetFlow and IPFIX flow records over UDP. This | ||
input supports NetFlow versions 1, 5, 6, 7, 8 and 9, as well as IPFIX. For | ||
NetFlow versions older than 9, fields are mapped automatically to NetFlow v9. | ||
|
||
This module wraps the <<filebeat-input-netflow,netflow input>> to enrich the | ||
flow records with geolocation information about the IP endpoints by using | ||
Elasticsearch Ingest Node. | ||
|
||
[float] | ||
=== Compatibility | ||
|
||
This module requires the {elasticsearch-plugins}/ingest-geoip.html[ingest-geoip] | ||
Elasticsearch plugins. | ||
|
||
include::../include/running-modules.asciidoc[] | ||
|
||
include::../include/configuring-intro.asciidoc[] | ||
|
||
:fileset_ex: log | ||
|
||
include::../include/config-option-intro.asciidoc[] | ||
|
||
[float] | ||
==== `log` fileset settings | ||
|
||
The fileset is by default configured to listen for UDP traffic on | ||
`localhost:2055`. For most uses cases you will want to set the `netflow_host` | ||
variable to allow the input bind to all interfaces so that it can receive | ||
traffic from network devices. | ||
|
||
["source","yaml",subs="attributes"] | ||
----- | ||
- module: netflow | ||
log: | ||
enabled: true | ||
var: | ||
netflow_host: 0.0.0.0 | ||
netflow_port: 2055 | ||
----- | ||
|
||
`var.netflow_host`:: Address to find to. Defaults to `localhost`. | ||
|
||
`var.netflow_port`:: Port to listen on. Defaults to `2055`. | ||
|
||
`var.max_message_size`:: The maximum size of the message received over UDP. | ||
The default is `10KiB`. | ||
|
||
`var.expiration_timeout`:: The time before an idle session or unused template is | ||
expired. Only applicable to v9 and IPFIX protocols. A value of zero disables | ||
expiration. | ||
|
||
`var.queue_size`:: The maximum number of packets that can be queued for | ||
processing. Use this setting to avoid packet-loss when dealing with occasional | ||
bursts of traffic. | ||
|
||
:has-dashboards!: | ||
|
||
:fileset_ex!: | ||
|
||
:modulename!: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- key: netflow-module | ||
title: NetFlow | ||
description: > | ||
Module for receiving NetFlow and IPFIX flow records over UDP. The module | ||
does not add fields beyond what the netflow input provides. | ||
fields: |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type: netflow | ||
protocols: [v1, v5, v6, v7, v8, v9, ipfix] | ||
host: '{{.netflow_host}}:{{.netflow_port}}' | ||
max_message_size: '{{.max_message_size}}' | ||
expiration_timeout: '{{.expiration_timeout}}' | ||
queue_size: {{.queue_size}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"description": "Pipeline for Filebeat NetFlow", | ||
"processors": [ | ||
{ | ||
"geoip": { | ||
"if": "ctx.source?.geo == null", | ||
"field": "source.ip", | ||
"target_field": "source.geo", | ||
"ignore_missing": true | ||
} | ||
}, | ||
{ | ||
"geoip": { | ||
"if": "ctx.destination?.geo == null", | ||
"field": "destination.ip", | ||
"target_field": "destination.geo", | ||
"ignore_missing": true | ||
} | ||
} | ||
], | ||
"on_failure": [ | ||
{ | ||
"set": { | ||
"field": "error.message", | ||
"value": "{{ _ingest.on_failure_message }}" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module_version: "1.0" | ||
|
||
var: | ||
- name: netflow_host | ||
default: localhost | ||
- name: netflow_port | ||
default: 2055 | ||
- name: max_message_size | ||
default: 10KiB | ||
- name: expiration_timeout | ||
default: 30m | ||
- name: queue_size | ||
default: 8192 | ||
|
||
ingest_pipeline: ingest/pipeline.json | ||
input: config/netflow.yml | ||
|
||
requires.processors: | ||
- name: geoip | ||
plugin: ingest-geoip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Module: netflow | ||
# Docs: https://www.elastic.co/guide/en/beats/filebeat/master/filebeat-module-netflow.html | ||
|
||
- module: netflow | ||
log: | ||
enabled: true | ||
var: | ||
netflow_host: localhost | ||
netflow_port: 2055 |