Logstash: The Easiest Way To Install It On Ubuntu 20.04

Photo by Andrea Piacquadio from Pexels

This is the straight and straightforward way to install Logstash either on your Ubuntu 20.04 desktop or your Ubuntu 20.04 server instance.

Do you want to extract data from some log files or a database? And you’ve just heard about Logstash and want to give it a try? Well, you’ve come to the right guide.

1- Update your system

First things first. Let’s start on the right basis.

sudo apt update && apt upgrade

2- Install Logstash

Logstash uses Java. It requires one of these versions of java:

  • Java 8
  • Java 11
  • Java 15

Let’s go with the oldest to make things simple.

sudo apt install openjdk-8-jre-headlesssudo apt updatesudo apt install logstash

3- Set up your first Logstash pipeline

Let us assume that you want to parse an apache access log file.

To create your first Logstash pipeline:

  • Install Elasticsearch

Go and check this link to Install and Configure Elasticsearch on Ubuntu 20.04.

  • Create your Logstash pipeline config file
sudo nano /etc/logstash/conf.d/first-logstash-pipeline.conf

Paste the code below:

⚠️ You do have to replace /path/to/your/log/file with your apache access log file path.

Example: /var/log/apache2/access.log

  • Run your pipeline with Logstash
sudo /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/first-logstash-pipeline.conf
  • Check the result on Elasticsearch

Launch a terminal and type:

curl -H "Content-Type: application/json" -XGET 127.0.0.1:9200/logs/_search?pretty 

I’ll be happy to hear that everything goes right for you during this installation. If you’ve any concerns, please let me know in the comments. I’ll be thrilled to help out.

May your Logstash usage journey be full of wonderful experiences.

See you, amigo!

--

--

--

Certified AWS Solution Architect, Fullstack Software Engineer & DevOps. I like Solving Challenging Software Engineering Problems & Building Amazing Solutions.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Getting Started with Visa API’s in Spring

Remote Method Invocation-RMI

Using Google Tag Manager as headless CMS

Working with Objects inside Kubernetes

Predictability in Product Development with Story Estimation

#Natgas is holding up with each surge higher. #NG_F #Natty https://t.co/8K86voxvrW

Django: CreateView

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
Akintola L. F. ADJIBAO

Akintola L. F. ADJIBAO

Certified AWS Solution Architect, Fullstack Software Engineer & DevOps. I like Solving Challenging Software Engineering Problems & Building Amazing Solutions.

More from Medium

SQLite IN OPERATION:

Stack In Data Structure Using Array

Parameterizing for loops

Understanding the database connection pool (DBCP) properties