1

我们如何获得过去 4 个月的时间表我尝试了以下查询,但它给了我固定的最后 4 个月数据,例如仅适用于 3 月、4 月、5 月、6 月 .. 我怎样才能获得 8 月 9 月 10 月和 11 月的数据。

PFB尝试查询..

index=foo earliest=-1mon@mon latest=-0mon@mon Technology="Sourcefire" 
| timechart span=1day count AS JUN-2020 
| appendcols [search index=SI earliest=-2mon@mon latest=-1mon@mon Technology="Sourcefire" 
  | timechart span=1day count AS MAY-2020] 
| appendcols [search index=SI earliest=-3mon@mon latest=-2mon@mon Technology="Sourcefire" 
  | timechart span=1day count AS APR-2020] 
| appendcols [search index=SI earliest=-4mon@mon latest=-3mon@mon Technology="Sourcefire" 
  | timechart span=1day count AS MAR-2020] 
| table _time JUN-2020 MAY-2020 APR-2020 MAR-2020

你也可以帮忙获取最近 4 周的数据吗.. 我试过下面哪个不起作用..

index=Foo earliest=-1w@w1 latest=-0w@w1 
| timechart span=1hour count by  RuleAction  
| appendcols [search index=FOO_1 | timechart span=1hour count by blocked ]
  appendcols [search index=Foo earliest=-2w@w1 latest=-1w@w1 
| timechart span=1hour count by  RuleAction 
| appendcols [search index=FOO_1  
| timechart span=1hour count by blocked ]
 appendcols [search index=Foo earliest=-3w@w1 latest=-2w@w1 
  | timechart span=1hour count by  RuleAction 
  | appendcols [search index=FOO_1  
  | timechart span=1hour count by blocked ]
 appendcols [search index=FOO earliest=-4w@w1 latest=-3w@w1 
| timechart span=1hour count by  RuleAction 
| appendcols [search index=ngss*_sourcefire_seceventFOO_1 
  | timechart span=1hour count by blocked ]
4

1 回答 1

1

如果您想要timechart过去 4 个月的时间,那么为什么不使用它呢?

index=foo earliest=-1mon@mon latest=-0mon@mon Technology="Sourcefire"
| append [ search index=SI earliest=-4mon@mon latest=-1mon@mon Technology="Sourcefire" ]
| timechart span=1d count

第二个查询的问题是一个常见的问题。该appendcols命令取决于顺序。这意味着来自子搜索的事件与来自主搜索的事件一对一地匹配。如果返回事件的顺序在子搜索中有所不同,那么结果将是不可预测的。改为使用append并让timechart命令对其进行排序。

于 2020-07-20T22:07:47.133 回答