您可以使用 LogCollector 的 keep_fields 插件保留指定字段,丢弃其余所有字段。
说明
LogCollector V2.2.5 及后续版本支持该插件。如何查看 LogCollector 版本,请参考2 查看软件版本。
名称 | 类型 | 是否必选 | 说明 |
---|---|---|---|
fields | Array | 是 | 要保留的字段名称列表。 |
日志内容:
{ "data": "Click Here", "size": "36", "style": "bold", "name": "text1", "hOffset": "250", "vOffset": "100", "alignment": "center", "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;", "time": "Today is 2023-06-08. Tomorrow is 2023-06-09." }
LogCollector 的 keep_fields 插件处理器配置:
仅保留日志中的size
、name
、time
字段。
{ "processors": [ { "keep_fields": { "fields": [ "size", "name", "time" ] } } ] }
处理结果:
{ "size": "36", "name": "text1", "time": "Today is 2023-06-08. Tomorrow is 2023-06-09." }