Splunk Search

Log filtering based on field value change.

rakes568
Explorer

I have two kinds of logs

sourcetype = abc IP = a.b.c.d status=active
sourcetype = abc IP = a.b.c.e status=active
sourcetype = abc IP = a.b.c.f status=active
sourcetype = abc IP = x.x.x.x status=inactive
sourcetype = abc IP = a.b.c.d status=inactive

I want to get a list of IP with status=active, but IP with whose status has changed to inactive should get filtered out.

Like in the example output should be:
a.b.c.e
a.b.c.f

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Try this.

 sourcetype = abc | dedup IP | where status="active"
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi rakes568
try something like this:
sourcetype = abc (status=active OR status=inactive)
| transaction IP
| search NOT status=inactive
| table IP

Bye.
Giuseppe

0 Karma

niketn
Legend

You can try the following:

<YourBaseSearch> sourcetype="abc" IP=* status="active" OR status="inactive"
| stats dc(status) as StatusCount values(status) as status by IP
| search status="active" AND status!="inactive"
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try this.

 sourcetype = abc | dedup IP | where status="active"
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...