Knowledge Management

Search driven by KVStore parameters

stephendavisWK
Explorer

I have a set of events similar to below and a working search for a single ID value of 133. My next step is to make the ID dynamic from a KVStore. My attempts so far have been unsuccessful and I could use some help. I am not even positive this is the right approach.

This is for a custom app for internal use so options are wide open on how to best approach this.
Ideas?

Events:
date time : Process Start for core instance ID: 133
date time : random message 1
date time : random message 5
date time : Process Ending ID: 133
date time : Process Start for core instance ID: 145
date time : random message 2
date time : random message 4
date time : random message 7
date time : Process Ending ID: 145
etc...

Working search:
index=myindex source=mysource
[search index=myindex ("Process Start" AND "ID: 133") | head 1 | eval earliest=_time | table earliest]
[search index=myindex ("Process Ending" AND "ID: 133") | head 1 | eval latest=_time+1 | table latest]
| eval StatusCode=
if((like(_raw, "%Process Start%") AND like(_raw, "%ID: 133%")), 1,
if(like(_raw, "%Process Ending%"), 2, 0))
| stats sum(StatusCode) as StatusCode, min(_time) as StartTime
| eval Started=if((StatusCode /1)>=1,"Success","Fail")
| eval Finished=if((StatusCode /2)>=1,"Success","Fail")
| eval Time=strftime(StartTime,"%c")
| table StartTime, evalVal1, evalVal2

Desired Results:
ID StartTime Started Finished
133 datetime Success Success
145 datetime Success Fail

0 Karma
1 Solution

stephendavisWK
Explorer

The final solution involved writing a python script which pulled data from a kvstore. Then using these parameters performing additional searches to gather events. The events were then accumulated in a json result set and returned to the client.

View solution in original post

0 Karma

stephendavisWK
Explorer

The final solution involved writing a python script which pulled data from a kvstore. Then using these parameters performing additional searches to gather events. The events were then accumulated in a json result set and returned to the client.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

@stephendavisWK, if your problem is resolved, please accept the answer.

---
If this reply helps you, Karma would be appreciated.
0 Karma

stephendavisWK
Explorer

Correction: "| table StartTime, evalVal1, evalVal2" in working search should be "| table StartTime, Started, Finished"

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!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...