logstash编码器(1)json

描述

将输入的json格式内容的事件编码为json文本。例如:

1
2
3
4
5
input { 
stdin {
codec => "json"
}
}

如果要传输由\n分隔的json事件,请查看json_lines编码器

效果

输入:

1
{"name":"tom","age":18}

输出:

1
2
3
4
5
6
7
{
"name" => "tom",
"@version" => "1",
"host" => "VM_0_10_centos",
"@timestamp" => 2019-01-16T14:23:13.743Z,
"age" => 18
}
>