Step 3: Configure Filebeat to use Logstash
editStep 3: Configure Filebeat to use Logstash
editPrerequisite
To send events to Logstash, you also need to create a Logstash configuration pipeline that listens for incoming Beats connections and indexes the received events into Elasticsearch. For more information, see the section about configuring Logstash in the Elastic Stack getting started tutorial. Also see the documentation for the Beats input and Elasticsearch output plugins.
If you want to use Logstash to perform additional processing on the data collected by Filebeat, you need to configure Filebeat to use Logstash.
To do this, you edit the Filebeat configuration file to disable the Elasticsearch output by commenting it out and enable the Logstash output by uncommenting the logstash section:
#----------------------------- Logstash output -------------------------------- output.logstash: hosts: ["127.0.0.1:5044"]
The hosts
option specifies the Logstash server and the port (5044
) where Logstash is configured to listen for incoming
Beats connections.
For this configuration, you must load the index template into Elasticsearch manually because the options for auto loading the template are only available for the Elasticsearch output.
Want to use Filebeat modules with Logstash? You need to do some extra setup. For more information, see Working with Filebeat modules.
To test your configuration file, change to the directory where the
Filebeat binary is installed, and run Filebeat in the foreground with
the following options specified: ./filebeat test config -e
. Make sure your
config files are in the path expected by Filebeat (see Directory layout),
or use the -c
flag to specify the path to the config file.