Getting Started with Logstash

edit

Getting Started with Logstash

edit

This section guides you through the process of installing Logstash and verifying that everything is running properly. After learning how to stash your first event, you go on to create a more advanced pipeline that takes Apache web logs as input, parses the logs, and writes the parsed data to an Elasticsearch cluster. Then you learn how to stitch together multiple input and output plugins to unify data from a variety of disparate sources.

This section includes the following topics:

Java (JVM) version

edit

Logstash requires one of these versions:

  • Java 8
  • Java 11
  • Java 14

Use the official Oracle distribution or an open-source distribution, such as OpenJDK. See the Elastic Support Matrix for the official word on supported versions across releases.

Bundled JDK

Logstash offers architecture-specific downloads that include AdoptOpenJDK 11, the latest long term support (LTS) release of JDK.

Use the JAVA_HOME environment variable if you want to use a JDK other than the version that is bundled. If you have the JAVA_HOME environment variable set to use a custom JDK, Logstash will continue to use the JDK version you have specified, even after you upgrade.

Check your Java version

edit

Run the following command:

java -version

On systems with Java installed, this command produces output similar to the following:

java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

JAVA_HOME

edit

Logstash uses the Java version set in JAVA_HOME. The JAVA_HOME environment variable must be set for Logstash to operate correctly.

On some Linux systems, you may need to have the JAVA_HOME environment exported before installing Logstash, particularly if you installed Java from a tarball. Logstash uses Java during installation to automatically detect your environment and install the correct startup method (SysV init scripts, Upstart, or systemd). If Logstash is unable to find the JAVA_HOME environment variable during package installation, you may get an error message, and Logstash will not start properly.