1. UTF-8编码,无BOM格式,否则容易乱码
2. 经过压缩的JSON——单行文件
3. 带有line terminators——否则会导致不出发logstash的event
通过配置output为:
output { stdout { codec => json } 输出:{"name":"lll","sex":"xxx","age":123,"@version":"1","@timestamp":"2016-03-07T15:51:04.211Z","path":"/home/data/test.json","host":"virtual-machine"}
可以发现,输出的内容也满足以上3个特点。
通过配置output为:
output { stdout { codec => rubydebug #codec => json } 输出:Logstash startup completed{ "name" => "lll", "sex" => "xxx", "age" => 123, "@version" => "1", "@timestamp" => "2016-03-07T15:51:43.005Z", "path" => "/home/data/test.json", "host" => "virtual-machine"}
可以发现,输出的格式为ruby JSON。
时间: 2024-10-31 06:38:19