How to Install Logstash: A Simple, Step-by-Step Guide

Learn how to easily set up Logstash on your system to collect, process, and send your data anywhere you want.

logstash

Welcome to the World of Data Processing

Linux/Windows

What is Logstash and Why Do You Need It?

Logstash is a powerful, free, and open-source tool created by Elastic that helps you manage your data. Think of it as a busy central post office for your digital information. It takes raw data from many different places, like your websites, applications, or computer servers, and brings it all into one single pipeline. This makes it much easier to collect and keep track of everything happening across all your computer systems without having to visit each system one by one.

The way Logstash works is built on three simple stages: input, filter, and output. First, the "input" stage collects data from all your different sources at the exact same time. Next, the "filter" stage cleans, organizes, and changes this raw data so it is neat and easy to read. Finally, the "output" stage sends this beautifully cleaned-up data to a storage place, like Elasticsearch, where you can easily search through it and create visual charts.

Using Logstash saves you a massive amount of time and effort because it automates the messy job of organizing information. Instead of manually reading through thousands of confusing text files to find an error, Logstash does the hard work for you in real-time. Whether you want to monitor your computer's health, find broken code quickly, or understand what your users are doing, Logstash prepares your data perfectly so you can find the answers you need right away.

Prerequisites

  • Operating System: A machine running a supported operating system like Linux (Ubuntu, Debian, CentOS, RHEL) or Windows.
  • Administrator Access: You need "root" or administrator privileges to run installation commands and change system files.
  • Java (JVM): Logstash requires Java 11, 17, or 21. (Good News: Logstash version 8.x comes with a bundled Java installed automatically, so you do not need to download Java separately unless you want a custom setup!)
  • Internet Connection: A stable internet connection to download the required software packages and security keys.
  • Basic Terminal Knowledge: A basic understanding of how to open and type commands into your computer's terminal or command prompt.

Step-by-Step Installation

1

Install Logstash (Choose Your Operating System)

Option A: Install on Ubuntu/Debian (APT)

1. Download and install the Public Signing Key:
BASH
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elastic-keyring.gpg
2. Install the tool needed to download from secure websites:
BASH
sudo apt-get install apt-transport-https
3. Save the Logstash download link to your system:
BASH
echo "deb [signed-by=/usr/share/keyrings/elastic-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-8.x.list
4. Update your system and install Logstash:
BASH
sudo apt-get update && sudo apt-get install logstash

Option B: Install on CentOS/RHEL (YUM)

1. Download and install the public signing key:
BASH
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
2. Open a new configuration file:
BASH
sudo nano /etc/yum.repos.d/logstash.repo
3. Paste the following text into the file, then save and exit:
Ini, TOML
[logstash-8.x]
name=Elastic repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
4. Install Logstash:
BASH
sudo yum install logstash

Option C: Install on Windows

1. Download the ZIP file:
Go to your web browser and download the Windows ZIP file from the official website: https://www.elastic.co/downloads/logstash
2. Extract the file:
Unzip the downloaded file into a folder on your computer (for example, C:\logstash-8.x.x ). (Important: Make sure the folder path does not have any special characters or colons : in the name).
2

Start and Enable Logstash

Logstash will not start by itself after you install it. You have to turn it on using the commands below.

For Linux (Ubuntu/Debian/CentOS/RHEL)

1. Refresh your system's background services:
BASH
sudo systemctl daemon-reload
2. Turn on the Logstash service:
BASH
sudo systemctl start logstash.service
3. Tell Logstash to start automatically every time you turn on your computer:
BASH
sudo systemctl enable logstash.service

For Windows

1. Open your Command Prompt.
2. Go to the folder where you unzipped Logstash and run it:
PowerShell
cd C:\logstash-8.x.x\
.\bin\logstash.bat -f .\config\logstash-sample.conf
3

Check if it works!

To make sure Logstash is running happily on Linux, you can run a quick status check.
Check the status:
BASH
sudo systemctl status logstash.service
(If everything is correct, you will see green text saying active (running) ).

Discover CTCservers Dedicated Server Locations

CTCservers servers are available around the world, providing diverse options for hosting websites. Each region offers unique advantages, making it easier to choose a location that best suits your specific hosting needs.