通过_time将Splunk Dedup重叠并将一个场的值组合成一个事件

时间:2017-11-21 03:45:29

标签: duplicates splunk splunk-query splunk-calculation

我正在使用Exchange 2010数据。我有MessageID,Sender,Recipients和_time。根据事件类型,可以拆分收件人(即,给定邮件的所有收件人都不包含在事件中,但会分配到多个事件中)。以下是数据示例:

index=ExchangeIndex sourcetype=MSExchange:2010:Message tracking
| stats values(Recipients) as recip by MessageID, Sender
| table _time, MessageID, Sender, recip

我使用此查询通过MessageID和Sender将多个Recipients值组合成一个事件:

_time     MessageID   Sender    recip
          <12345>     Sender1   Recipient1; Recipient2

这导致:

values

_time未填充,因为如果by语句中包含_time,dedup将无效,因为特定MessageID的每个事件都发生在不同的时间。因此,我需要以某种方式| stats max(_time) as datetime by MessageID, Sender | stats values(Recipients) as recip by datetime, MessageID, Sender | table datetime, MessageID, Sender, recip MessageID(以获取最新的_time)并同时填充收件人值。

我试过这个:

_time    MessageID    Sender    recip
4:50     <12345>      Sender1   

但这也不起作用,导致收件人没有填充:

_time     MessageID   Sender    recip
4:50      <12345>     Sender1   Recipient1; Recipient2

我想要的输出如下:

{{1}}

我该如何实现?

2 个答案:

答案 0 :(得分:0)

我想我明白了你的意思..收据和发件人没有相同的时间戳,所以他们永远不会在同一行?

如果是,请在下面尝试此操作。这假设收据和发件人彼此相距10分钟

index=ExchangeIndex sourcetype=MSExchange:2010:Message tracking
| bin _time span=10m
| stats values(Recipients) as recp values(MessageID) AS MessageID 
  values(Sender) AS Sender by _time

答案 1 :(得分:0)

Try this:

index=ExchangeIndex sourcetype=MSExchange:2010:Message tracking
stats latest(_time) as latestTime, values(Recipients) as recip by MessageID, Sender
table latestTime, MessageID, Sender, recip
convert ctime(latestTime)