ELK 搭建8

2022-02-11 16:40:59 浏览数 (1)

logstash的配置文件

代码语言:javascript复制
[root@h102 etc]# vim logstash-simple.conf
[root@h102 etc]# cat logstash-simple.conf 
input {stdin{}}
output {
	stdout {codec => rubydebug}
} 
[root@h102 etc]# /opt/logstash/bin/logstash -f logstash-simple.conf --configtest
Configuration OK
[root@h102 etc]# time /opt/logstash/bin/logstash -f logstash-simple.conf --configtest
Configuration OK

real	0m18.992s
user	0m32.038s
sys	0m1.425s
[root@h102 etc]# 

使用 --configtest 参数可以对配置文件进行检查,但感觉这么点内容,要花这么长时间,有点不可思议

(相较而言Nginx的检查就在一瞬间,是由于JVM的启停么,专门为检查配置写个脚本也要不了多少代码吧)

检查好后,可以使用 -f 直接运行了

代码语言:javascript复制
[root@h102 etc]# /opt/logstash/bin/logstash -f logstash-simple.conf
Settings: Default filter workers: 1
Logstash startup completed
simple test
{
       "message" => "simple test",
      "@version" => "1",
    "@timestamp" => "2015-12-22T13:10:11.729Z",
          "host" => "h102.temp"
}
getting started with logstash
{
       "message" => "getting started with logstash",
      "@version" => "1",
    "@timestamp" => "2015-12-22T13:10:34.294Z",
          "host" => "h102.temp"
}
hello example
{
       "message" => "hello example",
      "@version" => "1",
    "@timestamp" => "2015-12-22T13:10:39.486Z",
          "host" => "h102.temp"
}
...
...

0 人点赞