splunk 地图传递多个值

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

我想根据以下搜索创建警报:

  • 搜索字符串“a.string”
  • 提取字段 xx,yy
  • 然后搜索“another.string”和 xx
  • 然后提取字段zz
  • |表 xx、yy、zz

这是我的想法(删除了霸王龙行中的其他固定字符串):

index=* "a.string" 
| rex field=_raw "(?P<xx>\S+) (?P<yy>\S+)" 
| map maxsearches=100 search="search index=* "another.string" AND $xx$ 
  | rex field=_raw (?P<zz>\S+)"
  | eval temp_xx=\"$xx$\"
  | eval temp_yy=\"$yy$\""
| eval xx=temp_xx
| eval yy=temp_yy
| fields - temp_xx
| fields - temp_yy
| table xx, yy, zz

一切正常,包括我在最终搜索结果表中得到了 xx、zz 的值。

但是,最终搜索结果表 yy 始终为空。

单击 Splunk webgui 上的“事件”选项卡时,我可以看到 xx、yy、zz 的所有多个值,这意味着我的两次搜索都成功了。

但是为什么我在最终的搜索结果表中无法获取到 yy 的值,如何解决?

splunk splunk-query splunk-formula
1个回答
0
投票

您可以尝试这样的事情(假设您在每个事件中都有一个像

hostname
这样的公共字段):

index=ndx sourcetype=srctp ("a.string" OR "another.string")
| rex field=_raw "some text that exists in events with a.string (?<xx>\S+) (?<yy>\s+)"
| rex field=_raw "other text found with another.string (?<zz>\S+)"
| fields xx yy zz hostname
| stats values(*) as * by hostname
| where isnotnull(xx) AND isnotnull(zz)
© www.soinside.com 2019 - 2024. All rights reserved.