概述
支持解析Object类型的JSON日志,提取JSON日志内容作为Key-Value键值对,即Object首层的键作为Key,Object首层的值作为Value。
示例
如您需要采集的原始数据为:
- 原始日志:
{"time_local":"22/Jan/2019:19:19:34 +0800","body_sent":23,"responsetime":0.232,"upstreamtime":"0.232","http_host":"127.0.0.1","method":"POST","request":"POST","xff":"-","referer":"https://www.ctyun.cn","agent":"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0","response_code":"200"}
- 经过结构化处理后,采集到云日志服务后的日志如下:
agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0 body_sent: 23 http_host: 127.0.0.1 method: POST referer: https://www.ctyun.cn request: POST response_code: 200 responsetime: 0.232 time_local: 12/Jan/2023:21:33:18 +0800 upstreamtime: 0.232 xff: - __message__: {"time_local":"22/Jan/2019:19:19:34 +0800","body_sent":23,"responsetime":0.232,"upstreamtime":"0.232","http_host":"127.0.0.1","method":"POST","request":"POST","xff":"-","referer":"https://www.ctyun.cn","agent":"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0","response_code":"200"}
配置说明
在日志接入流程中-创建采集配置步骤中,切割模式选择JSON模式即可。