Splunk Search

How to compare two fields values for two different time ranges

faisal_saifi
New Member
index=nessus severity!=informational severity!=low severity!=medium earliest=-1mon@mon latest=-0mon@mon | top 0 signature | fields - count,percent | rename signature as sign1 | appendcols [search index=nessus severity!=informational severity!=low severity!=medium earliest=-2mon@mon latest=-1mon@mon | top 0 signature | fields - count,percent | rename signature as sign2 ] | where sign1 = sign2

using above search to count the same signature triggered for two different months. i need to compare all values of field sign1 with all values of field sign2. but sign1=sign2 is comparing only the values in same row not the full column.

0 Karma
1 Solution

somesoni2
Revered Legend

Try like this (will return signatures which are available in both time ranges).

index=nessus severity!=informational severity!=low severity!=medium earliest=-2mon@mon latest=-0mon@mon 
| eval timerange=if(_time>relative_time(now(),"-1mon@mon"),"timerange1","timerange2") 
| stats dc(timerange) as timerange by signature | where timerange=2

View solution in original post

0 Karma

somesoni2
Revered Legend

Try like this (will return signatures which are available in both time ranges).

index=nessus severity!=informational severity!=low severity!=medium earliest=-2mon@mon latest=-0mon@mon 
| eval timerange=if(_time>relative_time(now(),"-1mon@mon"),"timerange1","timerange2") 
| stats dc(timerange) as timerange by signature | where timerange=2
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...