Logstash, the L component in the ELK stack, is a tool to ingest data from multiple sources, process, transform, enrich, and send it to Elasticsearch.
In simple words, you can use Logstash to extract the information you need from the raw data.
In this tutorial, I will show you how to install Logstash the easiest way on Ubuntu & other Linux distributions.
Contents
How to Install Logstash on Linux
There are 5 common ways to install Logstash on Ubuntu & other Linux distributions:
- Install Logstash using the tar.gz package (for all Linux distributions, recommended)
- Install Logstash using apt (for Debian-based distributions)
- Install Logstash using the deb package (for Debian-based distributions)
- Install Logstash using the rpm package (for Red Hat-based distributions)
- Install Logstash using Docker
Each way has its pros and cons. To me, I suggest you install Logstash using the tarball (tar.gz package) as it will be easy to customize the config later and can be installed on any Linux distribution.
However, I will show you all 5 ways to install Logstash on Linux. Let's get started.
The Logstash version at the time of writing is 8.11.3. You can choose your appropriate platform by visiting the official download page.
1. Install Logstash using the tar.gz package
Using the tar.gz package, you can install Logstash on any Linux distribution.
To install Logstash using the tar.gz package, follow these steps:
-
Download the Logstash tar.gz package:
-
Extract the tar.gz package:
-
Now move it to the
~/elastic
folder for easy management:
Logstash is installed at ~/elastic/logstash-8.11.3
. To run it, use the command:
2. Install Logstash using apt
The apt package is available for Debian-based distributions such as Ubuntu, Debian, Linux Mint, etc.
To install Logstash using apt, follow these steps:
-
Download and install the public signing key:
-
Install the
apt-transport-https
package on Debian-based distributions: -
Save the repository definition to
/etc/apt/sources.list.d/elastic-8.x.list
: -
Run
apt update
to update the package database, then install Logstash:
Now Logstash is installed at the default directory: /usr/share/logstash
. To run it as a service, use the command:
You can check the status of the service using the command:
If you see the status is active like the image, then Logstash is running successfully.
To stop Logstash, use the command:
3. Install Logstash using the deb package
Similar to the apt way, the deb package is also available for Debian-based distributions such as Ubuntu, Debian, Linux Mint, etc.
To install Logstash using the deb package, follow these steps:
-
Download the Logstash deb package:
-
Install the deb package:
-
Start Logstash service:
-
Check the Logstash service status:
-
Stop Logstash service:
4. Install Logstash using the rpm package
The rpm package is available for Red Hat-based distributions such as CentOS, SLES, OpenSuSE, etc.
To install Logstash using the rpm package, follow these steps:
-
Download the Logstash rpm package:
-
Install the rpm package:
-
Start Logstash service:
-
Check the Logstash service status:
-
Stop Logstash service:
5. Install Logstash using Docker
To install Logstash using Docker, follow these steps:
-
Pull the Logstash image from Docker Hub:
-
Run the Logstash container:
-
Check the container status:
-
Check the Logstash logs:
-
Stop the Logstash container:
Conclusion
Congratulations, you have installed Logstash on Linux successfully.
If you need any assistance, feel free to leave a comment below.
Comments
Be the first to comment!