Splunk Search

how can i perform a filter after i do a search

thaghost99
Path Finder

date                          reportid    notificationid     status

10/1/2020            5555                       1                  clear

10/1/2020            2222                      2                  clear

10/2/2020           3333                      3                   critical

10/3/2020           5555                       4                   major

10/4/2020           2222                   5                       critical

10/4/2020           5555                       4                   clear

 

i would like to display the latest Status by Date based on the REPORT ID (unique id only displays).  

output:

date                          reportid    notificationid     status

10/2/2020           3333                      3                   critical

10/4/2020           2222                   5                       critical

10/4/2020           5555                       4                   clear

but after the output is displayed, i would like to also now filter/display based on a status. 

example, based on the initial result, i want to only show if the status = CLEAR

 

output:

date                          reportid    notificationid     status

10/4/2020           5555                       4                   clear

 

but i keep getting stuck.. here is my current search that is able to get the initial output. but i dont know how to then filter it further based on intial results. all my searche dont work. 

 

index=companyx sourcetype=alarm_status 
| eval Start=strftime(Start/1000, "%H:%M:%S %d-%b-%Y")
|rex field=AlarmPath "^\/(?<AlarmPath1>.+?)\/(?<AlarmPath2>.*)\s\("
|dedup reportid   
|search AlarmPath1="$field2$"
| stats Last(reportid) as ReportId, last(status) as status, last(AlarmPath1) as AlarmPath1, last(AlarmPath2) as AlarmPath2, last(Start) as "Start Time" , by notificationId
| sort -notificationId

Labels (3)
0 Karma
1 Solution

burwell
SplunkTrust
SplunkTrust

You could add a final

| search status=clear

 

View solution in original post

burwell
SplunkTrust
SplunkTrust

You could add a final

| search status=clear

 

thaghost99
Path Finder

oh man. thank you thank you thank you 🙂 it worked great. 

0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...