如何在Splunk中从JSON字符串中提取字段?

问题描述 投票:0回答:1

在Splunk中,我搜索后得到以下结果----------。

FINISH OnDemandModel - Model: Application:GVAP RequestID:test_manifest_0003 Project:AMPS EMRid:j-XHFRN0A4M3QQ status:success

我想提取Application、RequestID、Project、EMRid和status等字段作为列和对应的值作为这些列的值。

我是Splunk的新手,不知道如何使用spath或其他搜索命令。

splunk splunk-query
1个回答
2
投票

使用 rex 指挥:

<search>
rex field=yourfield "Application:(?<application>\w+)\sRequestID:(?<requestid>\w+)\sProject:(?<project>\w+)\sEMRid:(?<emrid>\w+)\sstatus:(?<status>\w+)"

在regex101.com上微调你的regex。

© www.soinside.com 2019 - 2024. All rights reserved.