JSON提取器和嵌套字段存在问题

问题描述

我遇到JSON字段提取不正确的问题。

首先,我的输入上有一个JSON提取器,用于提取消息字段,这将导致一个新的MESSAGE字段,其内容如下:

{“种类”:“事件”,“ apiVersion”:“ audit.k8s.io/v1”,“级别”:“元数据”,“ auditID”:“ e03a5c76-2122-4c1d-8265-be6e9cdc5e11”, “ stage”:“ ResponseComplete”,“ requestURI”:“ / api / v1 / namespaces / ingress-Nginx / configmaps / ingress-controller-leader-Nginx”,“ verb”:“ update”,“ user”:{“用户名“:”“ system:serviceaccount:ingress-Nginx:ingress-Nginx”,“ uid”:“ 42491580-cda5-4856-9f1b-ae133faadba7”,“ groups”:[“ system:serviceaccounts”,“ system:serviceaccounts:ingress- Nginx“,” system:authenticated“]},” sourceIPs“:[” 10.81.100.2“],” userAgent“:” nginx-ingress-controller / v0.40.2(linux / amd64)ingress-Nginx / fc4ccc5eb0e41be2436a978b01477fc354f31643“,” objectRef“:{” resource“:” configmaps“,” namespace“:” ingress-Nginx“,” name“:” ingress-controller-leader-Nginx“,” uid“:” 7bd1f348-9586-45ea-b41c-897c8ba83985 “,” apiVersion“:” v1“,” resourceVersion“:” 178373“},” responseStatus“:{”元数据“:{},”代码“:200},” requestReceivedTimestamp“:” 2020-11-04T09:21 :18.756400Z“,” stageTimestamp“:” 2020-11-04T09:21:18.759305Z“,” 注释“:{” authentication.k8s.i o /传统令牌”:“系统:服务帐户:ingress-Nginx:ingress-Nginx”,“ authorization.k8s.io/decision”:“允许”,“ authorization.k8s.io/reason”:“ RBAC:允许角色“ ingress-Nginx”的RoleBinding“ ingress-Nginx / ingress-Nginx”与ServiceAccount“ ingress-Nginx / ingress-Nginx”“”} }

但是接下来的问题是,JSON路径注释(粗体)没有提取到字段中。有什么办法可以做到这一点?

谢谢!

解决方法

这很可能是因为cmap,更具体地说是annotations的属性值破坏了JSON格式。