Logstash基础配置

904 词

编辑:糖果

Logstash的启动脚本中有比较多的命令行参数:

###-f :用于指定配置文件

使用文件,目录,或者通配符加载配置信息,如果指定为目录或者通配符,按字母顺序加载。

###-e: 用于指定字符串输入

默认输入为,

stdin { type => stdin }

默认输出为:

stdout { codec => rubydebug }}

-w: 指FilterWorkers的数量,默认为1

-l:指定输出文件的路径,默认为控制台输出

–verbose:设置较少的日志

–debug:设置更消息的日志

–watchdog-timeout TIMEOUT 设置watchdog超时时间,默认为10秒。

启动案例:

bin/logstash -f logstash-simple.conf  -w 2 

logstash-simple.conf内容为:

input { stdin { } } #输入

filter{}            #过滤器
output {            #输出
  elasticsearch { host => localhost }
  stdout { codec => rubydebug }
}

插件安装:

LS提供了一个plugin脚本用于安装输入输出插件。

$LS_HOME/bin/plugin

如:安装KafKa插件

bin/plugin install logstash-output-kafka

卸载KafKa插件

bin/plugin uninstall logstash-output-kafka

更新所有的插件

bin/plugin update

更新单个插件

bin/plugin update logstash-output-kafka

查看插件列表

bin/plugin list
bin/plugin list ko  列出包含ko字符的插件
bin/plugin list --group output 列出指定组的插件。

原文