Splunk Search

Compare field of each event with Subsearch of past each events

sarumathi
Loves-to-Learn Lots

1. If the same JobName field name is already exists,Trying to get average of column value of JobName's elapsedtime value

2. With the average value,I should compare the today's field name with previous date field name's value.

Eg: JobName: 'script_run'   ElapsedTime: 5 -> Here I need to check whether the 'Script name' field name is already existing( In previous Date) or not. If exists, Compare the elapsedtime '5' with that yesterday or any previous day value of  same 'script_run'. If the today's elapsed value is greater than previous day's value, I need to highlight in report. So iterating the today's each JobName with each jobName of previous day to compare the values of each elapsed time of each JobName is needed here.

JobNames are also different. so no any match case is not required here. Getting the JobNames with field name

 

index="application_**" host="W4Q**" sourcetype="log"

[search index="application_**" host="W4Q**" sourcetype="log" earliest=-1d@d latest=now

| top JobName,SecondsElapsed | table JobName,SecondsElapsed]

| stats avg(SecondsElapsed) as Duration by JobName,SecondsElapsed

| stats count(eval(if(SecondsElapsed > Duration,true,0))) as LongRun by JobName

 | foreach *

    [eval <<FIELD>>_VAL=if('<<FIELD>>'>Duration,'true',null())]

 

Any help for this.

 

Thanks

Labels (1)
Tags (1)
0 Karma
Get Updates on the Splunk Community!

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...

[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 ...

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...