簡體   English   中英

如何將 JSON 文件解析為 SPLUNK?

[英]how do I parse a JSON file to SPLUNK?

我想加載一個 evetlogs 的 JSON 文件作為 SPLUNK 的 source_type。 如何將其解析為可以執行搜索的內容? 謝謝你

如果可以攝取文件,則可以設置KV_MODE=json並且字段將被正確解析。 請參閱https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Automatickey-valuefieldextractionsatsearch-time

如果您已經攝取了該文件,則可以使用spath正確提取字段。 請參閱https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath 將其用作index=* | spath output=out_field path=path_field index=* | spath output=out_field path=path_field

您還可以使用eval命令的spath 請參閱https://docs.splunk.com/Documentation/Splunk/8.0.6/SearchReference/TextFunctions#spath.28X.2CY.29 您可以將其用作index=* | eval f=spath(_raw, "foo.bah") index=* | eval f=spath(_raw, "foo.bah")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM