天天看点

【有用】Splunk 多个index fileds value 交叉比较SPL

现在有个场景就是 有两个index: index_A, and index_B, index_A 中的 one filed: (Filed_A) 在index_B 中也出现了,Filed_B, 两个数量不一样,Filed_B 的value 值 被包含在Index_A 中的 Filed_A 中。

现在要把相同的值展示出来,并且要把Index_B 中剩下的那些filed_B 也展示出来:

我们来做实验:

1. We have tested the SQL below, and it works as expected.

================

(index=unix date_second=*) OR (index=itsi_summary date_second=* )

| eval "unix.date_second"=if(index="unix",date_second,null)

| eval "itsi_summary.date_second"=if(index="itsi_summary",date_second,null)

| stats values(unix.date_second) as host_A, values(itsi_summary.date_second) as host_B

| eval tmp=mv