Download, install and use Logstash

1. Environmental preparation

Logstash relies on JDK1.8, so please make sure that JDK1.8 has been installed and configured on the machine before installation.
You can refer to my article
Installation in Linux environment for installation

2. Download address

https://www.elastic.co/cn/downloads/logstash
Choose the consistent version according to your ES and kibana version to install
Insert picture description here

Three, download and install

download

wget https://artifacts.elastic.co/downloads/logstash/logstash-6.3.2.tar.gz

Unzip and move to the /usr/local folder and change the name

tar -xf logstash-6.3.2.tar.gz
mv logstash-6.3.2 /usr/local/
cd /usr/local/
mv logstash-6.3.2/ logstash

Four, modify the configuration

cd logstash/
vim config/logstash.yml

Modify http.host: "127.0.0.1" to http.host: "0.0.0.0", and open the access permission of port 9600 on the cloud server
Insert picture description here

Five, test

./bin/logstash -e 'input {stdin {}} output{stdout{}}' 

There are two options for running logstash configuration file:
Option 1: Use bin/logstash -e (configuration content is relatively simple, you can write one line, you can directly run the configuration file on the Linux command line to collect data)
such as:/ bin/logstash -e'input {stdin {}} output{stdout{}}'
keyword explanation:
input: configuration input
stdin: indicates command line data, if it is a file, it is file. (It can also be other input)
output: configuration output
stdout: indicates command line output
The meaning of this configuration file: any content input on the command line is collected and processed by logstash, and then output on the command line

    方案二:编写一个配置文件,使用 bin/logstash -f 运行该配置文件(./bin/logstash -f test.conf)
           vim /config/test.conf

Six, view

http://ip:9600/
Insert picture description here
If the browser returns the above result, the installation of Logstash is successful

Guess you like

Origin blog.csdn.net/weixin_44704985/article/details/111775996