Would you like to learn how to do a Logstash installation on Ubuntu Linux? In this tutorial, we are going to show you how to install Logstash on a computer running Ubuntu Linux.

• Ubuntu 20
• Ubuntu 19
• Ubuntu 18
• ElasticSearch 7.6.2
• Logstash 7.6.2

In our example, The ElastiSearch node 01 IP address is 192.168.100.9.

Tutorial Logstash - Installation

Use apt-get to install the required packages.

Copy to Clipboard

Find the Java installation directory.

Copy to Clipboard

In our example,  Java is installed on the following directory: /usr/lib/jvm/java-11-openjdk-amd64

Create a file to configure the required Java variables.

Copy to Clipboard

Here is the file content.

Copy to Clipboard

Reboot the computer.

Copy to Clipboard

Verify if the system created automatically the environment variable named: JAVA_HOME.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Download and install the ElasticSearch repository key.

Copy to Clipboard

Add the official ElasticSearch repository to your APT database

Copy to Clipboard

Update the APT-GET database and install the Logstash package.

Copy to Clipboard

Configure the Logstash service to start automatically.

Copy to Clipboard

Congratulations! You have finished the Logstash installation on Ubuntu Linux.

Tutorial Logstash - Configuration example

Stop the Logstash service.

Copy to Clipboard

Create a Logstash configuration file to receive Syslog information.

Copy to Clipboard

Here is the file content.

Copy to Clipboard

In our example, the Logstash service will listen to Syslog messages input on port 5000.

The Logstash service will process and send the Syslog information to the ElasticSearch server running on 192.168.100.9.

Start the Logstash service.

Copy to Clipboard

Congratulations! You have finished the Logstash configuration.

Tutorial Logstash - Sending Syslog messages

Use apt-get to install the required packages.

Copy to Clipboard

Stop the RSyslog service.

Copy to Clipboard

Edit the Syslog configuration file.

Copy to Clipboard

Add the following lines at the end of the file.

Copy to Clipboard

Start the RSyslog service.

Copy to Clipboard

In our example, Linux will send Syslog messages to the Logstash server IP address on port 5000.