首先,解压logstash的压缩包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[sqczm@sqczm opt]$ tar -zxvf logstash-6.7.1
[sqczm@sqczm opt]$ ll logstash-6.7.1
总用量 848
drwxrwxr-x. 2 sqczm sqczm 4096 4月 20 12:20 bin
drwxrwxr-x. 2 sqczm sqczm 142 4月 20 12:20 config
-rw-r--r--. 1 sqczm sqczm 2276 4月 3 00:53 CONTRIBUTORS
drwxr-xr-x. 2 sqczm sqczm 6 4月 3 00:53 data
-rw-r--r--. 1 sqczm sqczm 4194 4月 3 00:55 Gemfile
-rw-r--r--. 1 sqczm sqczm 22455 4月 3 00:55 Gemfile.lock
drwxrwxr-x. 6 sqczm sqczm 84 4月 20 12:20 lib
-rw-r--r--. 1 sqczm sqczm 13675 4月 3 00:53 LICENSE.txt
drwxrwxr-x. 4 sqczm sqczm 90 4月 20 12:20 logstash-core
drwxrwxr-x. 3 sqczm sqczm 86 4月 20 12:20 logstash-core-plugin-api
drwxrwxr-x. 4 sqczm sqczm 55 4月 20 12:20 modules
-rw-r--r--. 1 sqczm sqczm 808305 4月 3 00:53 NOTICE.TXT
drwxrwxr-x. 3 sqczm sqczm 30 4月 20 12:20 tools
drwxrwxr-x. 4 sqczm sqczm 33 4月 20 12:20 vendor
drwxrwxr-x. 10 sqczm sqczm 205 4月 20 12:20 x-pack

解压完毕后,我们来写个hello world来测试下

1
2
3
[sqczm@sqczm logstash-6.7.1]$ pwd
/opt/logstash-6.7.1
[sqczm@sqczm logstash-6.7.1]$ bin/logstash -e 'input { stdin {} } output { stdout {} }'

过一会等logstash启动成功后,我们在控制台上输入“hello world!”,然后回车,看到以下结果

1
2
3
4
5
6
{
"@timestamp" => 2019-04-20T04:35:20.440Z,
"message" => "hello world!",
"host" => "sqczm",
"@version" => "1"
}

没错,就是这么简单。