有没有办法将嵌套的JSON字符串过滤出流利的单独字段?
当前JSON:
{
Value1: "something",
Value2: "something",
Message:{
Value3: "Something",
Value3: "Something"
}
}
我想要什么(或类似的东西):
{
Value1: "something",
Value2: "something",
Message.Value3: "Something",
Message.Value3: "Something"
}
JSON不必像上面的示例中那样扁平化,但是我确实希望这些值在达到Elasticsearch时位于各自独立的字段(列)中。在其他方面,我想将单个长消息字符串拆分为包含在其中的多个字段。
尝试这个:
<source>
...
</source>
<filter myapp**>
@type parser
key_name Message
format multi_format
<pattern>
format json # try parsing json in the first place
</pattern>
<pattern>
format none # leave as is if this is not json (plaintext)
</pattern>
reserve_data true # keep the original Message field in case anything go wrong
</filter>
<match myapp**>
...
</match>
多种格式解析器:https://github.com/repeatedly/fluent-plugin-multi-format-parser
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句