Can't get filebeat Netflow Module to work

Hello Everyone,

I've been pulling my hair out trying to understand why Filebeat's net flow module keeps causing filebeats to end. Heres the error it keeps outputting:

2020-12-11T17:42:22.025-0700 ERROR instance/beat.go:956 Exiting: Failed to start crawler: creating module reloader failed: error creating config from fileset netflow/log: error unpacking configuration

I will include the netflow.yml, I have ran this through yamilint.com and it comes back without syntax errors, and the filebeat.yml

filebeat.yml
###################### Filebeat Configuration Example #########################

# This file is an example configuration file highlighting only the most common
# options. The filebeat.reference.yml file from the same directory contains all the
# supported options with more comments. You can use it as a reference.
#
# You can find the full configuration reference here:
# https://www.elastic.co/guide/en/beats/filebeat/index.html

# For more available modules and options, please see the filebeat.reference.yml sample
# configuration file.

# ===============================   Processors  ================================

# Processor for making sure the correct timezone is sent to Logstash.
processors:
  - add_host_metadata:
      when.not.contains.tags: forwarded
  - add_cloud_metadata: ~
  - add_docker_metadata: ~
  - add_kubernetes_metadata: ~
  - add_locale: ~

# ============================== Filebeat inputs ===============================

filebeat.inputs:

# Each - is an input. Most options can be set at the input level, so
# you can use different inputs for various configurations.
# Below are the input specific configurations.

- type: log

  # Change to true to enable this input configuration.
  enabled: true

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    - /var/log/*.log
    #- c:\programdata\elasticsearch\logs\*
    #- /opt/syslog/************.log
    - /opt/syslog/*.log

#########################################################################################
################################# CUSTOM INPUTS #########################################
#########################################################################################
#
- type: netflow
  max_message_size: 10KiB
  host: "************:2055"
  protocols: [ v5, v9, ipfix ]
  expiration_timeout: 30m
  queue_size: 8192
  #custom_definitions:
  #- /etc/filebeat/fields.yml
  detect_sequence_reset: true
#
#
#
#
########################################################################################



  # Exclude lines. A list of regular expressions to match. It drops the lines that are
  # matching any regular expression from the list.
  #exclude_lines: ['^DBG']

  # Include lines. A list of regular expressions to match. It exports the lines that are
  # matching any regular expression from the list.
  #include_lines: ['^ERR', '^WARN']

  # Exclude files. A list of regular expressions to match. Filebeat drops the files that
  # are matching any regular expression from the list. By default, no files are dropped.
  #exclude_files: ['.gz$']

  # Optional additional fields. These fields can be freely picked
  # to add additional information to the crawled log files for filtering
  #fields:
  #  level: debug
  #  review: 1

#########################################################################################################################
#########################################################################################################################

 ### Multiline options

  # Multiline can be used for log messages spanning multiple lines. This is common
  # for Java Stack Traces or C-Line Continuation

  # The regexp Pattern that has to be matched. The example pattern matches all lines starting with [
  #multiline.pattern: ^\[

  # Defines if the pattern set under pattern should be negated or not. Default is false.
  #multiline.negate: false

  # Match can be set to "after" or "before". It is used to define if lines should be append to a pattern
  # that was (not) matched before or after or as long as a pattern is not matched based on negate.
  # Note: After is the equivalent to previous and before is the equivalent to to next in Logstash
  #multiline.match: after

# filestream is an experimental input. It is going to replace log input in the future.
- type: filestream

  # Change to true to enable this input configuration.
  enabled: false

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    - /var/log/*.log
    #- c:\programdata\elasticsearch\logs\*

  # Exclude lines. A list of regular expressions to match. It drops the lines that are
  # matching any regular expression from the list.
  #exclude_lines: ['^DBG']

  # Include lines. A list of regular expressions to match. It exports the lines that are
  # matching any regular expression from the list.
  #include_lines: ['^ERR', '^WARN']

  # Exclude files. A list of regular expressions to match. Filebeat drops the files that
  # are matching any regular expression from the list. By default, no files are dropped.
  #prospector.scanner.exclude_files: ['.gz$']

  # Optional additional fields. These fields can be freely picked
  # to add additional information to the crawled log files for filtering
  #fields:
  #  level: debug
  #  review: 1

# ============================== Filebeat modules ==============================

filebeat.config.modules:
  # Glob pattern for configuration loading
  path: ${path.config}/modules.d/*.yml

  # Set to true to enable config reloading
  reload.enabled: false

  # Period on which files under path should be checked for changes
  #reload.period: 10s

# ======================= Elasticsearch template setting =======================

setup.template.settings:
  index.number_of_shards: 1
  #index.codec: best_compression
  #_source.enabled: false


# ================================== General ===================================

# The name of the shipper that publishes the network data. It can be used to group
# all the transactions sent by a single shipper in the web interface.
name: pFsense-Firewall

# The tags of the shipper are included in their own field with each
# transaction published.
tags: ["logstashed-filebeat"]

# Optional fields that you can specify to add additional information to the
# output.
#fields:logstash-pfsense-events
#  env: staging

# ================================= Dashboards =================================
# These settings control loading the sample dashboards to the Kibana index. Loading
# the dashboards is disabled by default and can be enabled either by setting the
# options here or by using the `setup` command.
#setup.dashboards.enabled: false

# The URL from where to download the dashboards archive. By default this URL
# has a value which is computed based on the Beat name and version. For released
# versions, this URL points to the dashboard archive on the artifacts.elastic.co
# website.
#setup.dashboards.url:

# =================================== Kibana ===================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
#setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  #host: "127.0.0.1:5601"

  # Kibana Space ID
  # ID of the Kibana Space into which the dashboards should be loaded. By default,
  # the Default Space will be used.
  #space.id:

# =============================== Elastic Cloud ================================

# These settings simplify using Filebeat with the Elastic Cloud (https://cloud.elastic.co/).

# The cloud.id setting overwrites the `output.elasticsearch.hosts` and
# `setup.kibana.host` options.
# You can find the `cloud.id` in the Elastic Cloud web UI.
#cloud.id:

# The cloud.auth setting overwrites the `output.elasticsearch.username` and
# `output.elasticsearch.password` settings. The format is `<user>:<pass>`.
#cloud.auth:

# ================================== Outputs ===================================

# Configure what output to use when sending the data collected by the beat.


################################################################################
##########CUSTOM OPTIONS FOR ENABLING FILEBEAT THROUGH LOGSTASH#################
################################################################################

#setup.ilm.overwrite: true

# ---------------------------- Elasticsearch Output ----------------------------
#output.elasticsearch:
  # Array of hosts to connect to.
   #hosts: ["http://************:9200"]

  # Protocol - either `http` (default) or `https`.
  #protocol: "https"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  #username: "elastic"
  #password: "changeme"

# ------------------------------ Logstash Output -------------------------------
output.logstash:
  # The Logstash hosts
   hosts: ["************:5044"]#This is the local Host
   #hosts: ["************:5044"]#CentOS V2 Should be listening here with its logstash node

  # Optional SSL. By default is off.
  # List of root certificates for HTTPS server verifications
  #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]

  # Certificate for SSL client authentication
  #ssl.certificate: "/etc/pki/client/cert.pem"

  # Client Certificate Key
  #ssl.key: "/etc/pki/client/cert.key"

This is the module netflow.yml
# Module: netflow
# Docs: https://www.elastic.co/guide/en/beats/filebeat/7.10/filebeat-module-netflow.html

- module: netflow
  log:
    enabled: true
    var:
      netflow_host: 172.20.1.123
      netflow_port: 2055
    var:
      tags:forwarded, netflow, pfsense

And I followed these steps on the guide:
made sure filebeat was connected to elastic search first.
filebeat setup
filebeat modules enable netflow
filebeat setup --pipelines --modules netflow
filebeat -e

and that's about when I get that error.
I have the pipeline ingest template loaded on elastic as I can see it through Kibana.

I can also confirm that when I don't load the module and just use the inline input in the filebeat.yml file I can see with net stat on my pfsense that its connected to my filebeat server on port 2055.

Its just that nothing populates elastic search and there are no events from elastic coming from netflow.

Is there a way to make this work?

Sorry in advance for the sloppy .yml files and convoluted explanation.
Thanks in advance if you can help.

Hello! Seems like its complaining about the netflow.yml file. Could you try this please:

- module: netflow
  log:
    enabled: true
    var:
      netflow_host: 172.20.1.123
      netflow_port: 2055
      tags: [forwarded]

my guess is it doesn't like the two var.*.
If the config above works, then we can try to add the rest of the tags into the list. Thanks!

I did try this, and I think that in all reality it actually did fix the original issue. But its hard to tell at the moment as I'm currently experiencing what looks to be some type of loop with Filebeat. I was reading that you can get this error if its like two process are reading the same directory at the same time, but I have to do some more digging to see if that is what is actually going on. This is the prominent error I'm getting now below:

ERROR fileset/factory.go:103 Error creating input: Can only start an input when all related states are finished:

Thanks for the help, I may be able to run a bit more troubleshooting on this and then post a bit more detail on the errors I'm getting with it.

Try to remove the CUSTOM INPUT in the filebeat.yml.
You just run multiple netflow collector in the same port. Just use one, eithen in filebeat.yml or in netflow.yml. Choose one.

Thanks for the help, I'll give that a try and then report back on what happens

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.