Splunk Search

how to show added and deleted in set diff

vinay4444
Explorer

I am using | set diff to find the names that have been changed yesterday compared to a week using the search as below

What i am trying to get is to show the ones that have been added and dropped in search it currently gives all together as one list.

| set diff [ search index=infra_service_perf sourcetype="XXX" itemKey ="XXXX" value >= 0.000 earliest=-1d@d latest=@m | stats count by name | table name ]

[ search index=infra_service_perf sourcetype="XXX" itemKey ="XXXX" value >= 0.000 earliest=-7d@d latest=-1d@d | stats count by name | table name ]

Tags (1)
0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Unfortunately, there is no such option in | set command, but you can achieve the same using an append-stats combination, like this

index=infra_service_perf sourcetype="XXX" itemKey ="XXXX" value >= 0.000 earliest=-1d@d latest=@m | stats count by name | table name | eval Action="Today" | append [ search index=infra_service_perf sourcetype="XXX" itemKey ="XXXX" value >= 0.000 earliest=-7d@d latest=-1d@d | stats count by name | table name | Action="Last7Days" ] | stats values(*) by name | where mvcount(Action)=1 | replace "Today" with "Added" "Last7Days" with "Deleted" in Action

View solution in original post

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Unfortunately, there is no such option in | set command, but you can achieve the same using an append-stats combination, like this

index=infra_service_perf sourcetype="XXX" itemKey ="XXXX" value >= 0.000 earliest=-1d@d latest=@m | stats count by name | table name | eval Action="Today" | append [ search index=infra_service_perf sourcetype="XXX" itemKey ="XXXX" value >= 0.000 earliest=-7d@d latest=-1d@d | stats count by name | table name | Action="Last7Days" ] | stats values(*) by name | where mvcount(Action)=1 | replace "Today" with "Added" "Last7Days" with "Deleted" in Action
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...