2013-03-01 166 views

回答

0

一种方法是将数据从第一次搜索传送到下一次,然后您可以进一步过滤结果。希望下面的简化搜索字符串会给你如何做到这一点的想法...

index=_internal | head 100 | fields host, sourcetype, source | search sourcetype="splunkd_access" 

欲了解更多信息,我建议通过Splunk Search Reference

4

FORMAT命令读书可以为这个特别有用。这是一个过于简单化的例子,但应该给你一个如何使用它的想法:

首先,制定你的子搜索,将给你你关心的领域。以下是一个正常运行的示例:

|metadata type=hosts index=_internal | table host | format 

尝试运行此搜索以查看其输出是什么样的。

然后,我们只是将其添加为您的实际搜索的subsearch:

index=foo sourcetype=bar [|metadata type=hosts index=_internal | table host | format] 

,这将使你从指数FOO,sourceType的酒吧,并从subsearch每个主机的事件。

这实际上是一个非常强大的命令,因为您可以使用它来动态设置时间范围以及复杂的布尔过滤器。

More FORMAT documentation can be found here

More complex example of what can be done with FORMAT