sql - Splunk 查询从 JSON 单元格中获取字段
问题描述
splunk 查询输出一个表,其中一个列具有这些类型的 json 提供此输出的查询部分是details.ANALYSIS
{"stepSuccess":false,"SR":false,"propertyMap":{"Url":"https://example.com","ErrCode":"401","transactionId":"7caf34342524-3d232133da","status":"API failing with error code 401"}}
我想编辑我的 splunk 查询,以便我只Url
在同一列中而不是这个 json。
这是我正在使用的 splunk 查询
|dbxquery connection="AT" query="select service.req_id, service.out,details.ANALYSIS from servicerequest service,SERVICEREQUEST_D details where service.out like 'XYZ is%' and service.row_created > sysdate-1 and service.SERVICEREQUEST_ID = details.SERVICEREQUEST_ID and details.ANALYSIS_CLASS_NAME = 'GetProduction' " shortnames=0 maxrows=100000001
我尝试使用 details.ANALYSIS.propertyMap.Url 但它会引发错误。
解决方案
您可能可以使用spath
从 details.ANALYSIS 中提取字段
尝试以下提取所有字段
| spath field="details.ANALYSIS"
或者这只是针对您所追求的 url 字段
| spath field="details.ANALYSIS" path="propertyMap.Url"
推荐阅读
- angular - 性能反应形式
- react-native - 氮氧化物;adb 服务器版本 (41) 与此客户端 (36) 不匹配;
- java - 使用jackson序列化、反序列化复杂对象
- excel - powerquery 过滤每年的 TopN 值
- amazon-web-services - “body”处的值未能满足约束:成员不得为空
- c# - 取消令牌不适用于天蓝色队列触发功能
- javascript - Javascript 命名空间 - 从对象文字表示法 (OLN) 更新数组值
- javascript - 使用 Ajax 调用调用 api
- python - python - 使用 pdfPages / matplotlib 在 pdf 中放置几个图 - ValueError: No figure AxesImage(54,36;334.8x217.44)
- r - R GRanges:在减少 GRanges 时计算平均元数据值