Splunk Search

How to search two different strings from the same source, but different timestamps?

Abilan1
Path Finder

Hi ,

I would like to know how to search two different search strings (Error and issue) from the same source file, but the error and issue both have different timestamps, so am unable to search in direct way. Please help me here. Thank You!

0 Karma
1 Solution

diogofgm
SplunkTrust
SplunkTrust

it took me some time to figure this out but i believe this is what you are looking for. (math logic)
Not the most performant search query but works.
replace my_index with your index and try this:

index=my_index "Handle State structures to abandoned" | stats count by source | eval status = "keep" | append [search index=my_index "KERNEL RECYCLING" | stats count by source | eval status = "remove" ] | stats values(status) AS status by source | search status!=remove

Small explanation on this:
1- list the sources that have "Handle State structures to abandoned" and build a field called status with "keep" as value

index=my_index "Handle State structures to abandoned" | stats count by source | eval status = "keep"

2 - list the sources that have "KERNEL RECYCLING", build a field called status with "remove" as value and append the result to 1:

...| append [search index=my_index "KERNEL RECYCLING" | stats count by source | eval status = "remove" ] 

3 - list both results by status (sources that you want keep or remove) and filter the ones you do not want to show:

...| stats values(status) AS status by source | search status!=remove
------------
Hope I was able to help you. If so, some karma would be appreciated.

View solution in original post

Abilan1
Path Finder

Hi ,

I want to create the dashboard, for the "Handle State structures to abandoned" this event, but If this "KERNEL RECYCLING" string is also in the same source file. I want to leave this source file from my Count. Like this I want to search all my source file and update the count in dashboard. Please let me know if you need more information. Thank You!!

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Self-Healing Pipeline Is Now Generally Available: AI-Powered CIM Compliance

Maintaining data integrity across security and analytics pipelines is an ongoing challenge. Data ...

[Puzzles] Solve, Learn, Repeat: Family Trees

This puzzle (first published here is based on finding grandparents and grandchildren (inspired by a question ...

Break the Build: Inside the KubeDoom Lounge at .conf26

    You step up to the machine. The pixelated corridors of a certain 1993 FPS load in front of you, EMP Pulse ...