配置文件的基本格式,输入部分,过滤器部分和输出部分。

#Thisisacomment.Youshouldusecommentstodescribe#partsofyourconfiguration.input{...}filter{...}output{...}


每个部分都可以配置一个或多个插件。下面展示的是输入部分,有两个file插件。

input{file{path=>"/var/log/messages"type=>"syslog"}file{path=>"/var/log/apache/access.log"type=>"apache"}}


插件的值类型

数组

path=>["/var/log/messages","/var/log/*.log"]path=>"/data/mysql/mysql.log"


布尔

ssl_enable=>true


字符串

name=>"Helloworld"name=>'It\'sabeautifulday'


哈希

match=>{"field1"=>"value1""field2"=>"value2"...}


字节

my_bytes=>"1113"#1113bytesmy_bytes=>"10MiB"#10485760bytesmy_bytes=>"100kib"#102400bytesmy_bytes=>"180mb"#180000000bytes


代码

codec=>"json"


数值:浮点或整型

port=>33


密码型:不会记录到日志或打印出来

my_password=>"password"


路径型:字符串

my_path=>"/tmp/logstash"


注释:使用#