Elasticsearch: How to install and set up FileBeat on Ubuntu 20.04.

Photo by Andrea Piacquadio from Pexels

1- Install Filebeat on your system

Let’s first upgrade and update our system.

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install filebeat

2- Configure Filebeat to send data to Elasticsearch

The next step of our setup is to tell Filebeat which Elasticsearch cluster it has to connect to in order to send the collected data.

cd /etc/filebeat
sudo nano filebeat.yml
output.elasticsearch:
hosts: ["ELASTICSEARCH-HOST-ADDRESS:9200"]
username: "YOUR_ELASTICSEARCH_USERNAME"
password: "YOUR_PASSWORD"

3- Configure Filebeat to send data to Kibana

Skip this step if Kibana is running on the same host as Elasticsearch. Let's configure the Kibana endpoint:

setup.kibana:
host: "KIBANA-HOST-ADDRESS:5601"
username: "YOUR_KIBANA_USERNAME"
password: "YOUR_PASSWORD"

4- Set the path to your logs

When we look into that Kibana config file, we notice that Filebeat reads logs base on some YAML files located at ${kibana-path}/modules.d.

cd /etc/filebeat/modules.d
ls -l
cp apache.yml.disabled apache.yml
sudo nano apache.yml
- module: apache
# Access logs
access:
enabled: true
# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
var.paths: /var/log/apache2/access.log
# Error logs
error:
enabled: true
# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
var.paths: /var/log/apache2/error.log
sudo systemctl start filebeat

5- Set up Kibana dashboard for Filebeat

Filebeat offers this amazing feature. It comes with a kind of pre-built dashboard that can be set up on Kibana with the data gathered by Filebeat.

cd /usr/share/filebeat/bin
sudo filebeat setup --dashboards

6- Visualize the output on Kibana

Finally, we can look at the result of our long long setup. Navigte to your Kibana Home Page. On your local, the address may be 127.0.0.1:5601.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store