Log Service provides a Logstash plug-in that allows you to upload log data through Logstash.

Background information

Logstash is a popular open-source data collection program. You can install the logstash-output-logservice plug-in to upload data to Log Service. For more information, see Logstash plug-in on Github.

Procedure

  1. Install the JDK.
    1. Download the JDK installer.

      Go to the Java official website, download the JDK installer as required, and then double-click the installer to install the JDK.

    2. Set the environment variables.

      Add or modify environment variables in advanced system settings.

      • PATH: C:\Program Files\Java\jdk1.8.0_73\bin
      • CLASSPATH: C:\Program Files\Java\jdk1.8.0_73\lib;C:\Program Files\Java\jdk1.8.0_73\lib\tools.jar
      • JAVA_HOME: C:\Program Files\Java\jdk1.8.0_73
    3. Verify that the JDK is installed.

      Run PowerShell or cmd.exe for verification.

      PS C:\Users\Administrator> java -version
      java version "1.8.0_73"
      Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
      Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)
      PS C:\Users\Administrator> javac -version
      javac 1.8.0_73
  2. Install Logstash.
    1. Download the installation package.

      Download the Logstash installation package.

      Note
      • We recommend that you download Logstash 5.0 or later.

      • Logstash 6.4.3 can be installed and runs properly on the following operating systems: macOS 10.14.1, Windows 7, and CentOS 7.

    2. Install Logstash.

      Decompress the installation package to a specified directory.

  3. Install the plug-in used by Logstash to write logs to Log Service.
    Install the plug-in online or offline based on the network environment where the server resides.
    • Online installation:

      The plug-in is hosted by RubyGems. For more information, see here.

      Run PowerShell or cmd.exe to go to the Logstash installation directory. Run the following command to install the logstash-output-logservice plug-in:
      PS C:\logstash-6.4.3> .\bin\logstash-plugin install logstash-output-logservice
    • Offline installation:

      Go to the logstash-output-logservice page, and click Download in the lower-right corner.

      If the server from which logs are collected cannot access the Internet, copy the downloaded gem package to a local directory. Run PowerShell or cmd.exe to go to the Logstash installation directory. Run the following command to install the logstash-output-logservice plug-in:
      PS C:\logstash-6.4.3> .\bin\logstash-plugin install C:\logstash-6.4.3\logstash-output-logservice-0.4.0.gem
    • Verification:
      PS C:\logstash-6.4.3> .\bin\logstash-plugin list

      Verify that logstash-output-logservice exists in the plug-in list of the server.