How to Install Logstash on Fedora Server Latest

Logstash is an open-source data processing tool, which can collect, enrich, and deliver data from different sources in real-time. In this tutorial, we will show you step-by-step how to install Logstash on Fedora Server Latest.

Pre-requisites

Before we begin, ensure the following requirements are met:

Step 1: Update the System

First, update the system to the latest version available:

sudo dnf update

Step 2: Install Java

Logstash requires Java to run. You can install Java using the following command:

sudo dnf install java-11-openjdk

Verify that Java is installed and set up correctly by running the following command:

java -version

If Java is installed correctly, you should see output similar to the following:

openjdk version "11.0.12" 2021-07-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7-LTS, mixed mode, sharing)

Step 3: Download Logstash

Next, download the latest version of Logstash from the official website. In this tutorial, we will use version 7.x:

sudo dnf install wget
wget https://artifacts.elastic.co/downloads/logstash/logstash-7.x.x.tar.gz

Replace 7.x.x with the latest version of Logstash available.

Once the download is complete, extract the archive using the following command:

tar -xzf logstash-7.x.x.tar.gz

Step 4: Configure Logstash

Logstash requires you to define pipelines to process your data. A pipeline consists of three sections: input, filter, and output. You can write your pipeline configuration in a .conf file and store it in the conf.d directory.

Create a configuration file with the following command:

sudo nano /etc/logstash/conf.d/my_pipeline.conf

Add the following content to the file, replacing port with the port number you want to listen on:

input {
    tcp {
        port => port
        codec => json_lines
    }
}

filter {
    # your filter logic goes here
}

output {
    elasticsearch {
        hosts => ["localhost:9200"]
    }
    stdout { codec => rubydebug }
}

Step 5: Start Logstash

Before we start Logstash, we need to specify the path of the Java binary in the JAVA_HOME environment variable. You can set this variable using the following command:

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk/

Replace /usr/lib/jvm/java-11-openjdk/ with the path to the Java installation on your system.

Once the JAVA_HOME variable is set, you can start Logstash using the following command:

sudo /path/to/logstash-7.x.x/bin/logstash -f /etc/logstash/conf.d/my_pipeline.conf

Replace /path/to/logstash-7.x.x/ with the path to the Logstash installation on your system.

If Logstash started successfully, you should see output similar to the following:

[INFO ] 2022-01-01 00:00:01.000 [main] runner - Starting Logstash {"logstash.version"=>"7.x.x", "jruby.version"=>"jruby 9.2.20.1 (2.5.8) 2022-11-01 b1a8ac452b OpenJDK 64-Bit Server VM 11.0.12+7-LTS on 11.0.12+7-LTS +indy +jit [linux-aarch64]"}
[INFO ] 2022-01-01 00:00:02.000 [main] agent - Successfully started Logstash API endpoint {:port=>9604}
[INFO ] 2022-01-01 00:00:03.000 [logstash.inputs.tcp    ] Listening for incoming TCP connection {:address=>"0.0.0.0:port"}

Conclusion

You have successfully installed Logstash on Fedora Server Latest and configured a basic pipeline to process data using Logstash. You can now create your own pipelines according to your data processing needs.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!