Splunk Search

define constant value

meenaoleti
New Member
 time  | a1| a2| a3 | a4 |
today  | 1 | 4 | 8 | 5 |   
today-1| 1 | 3 | 6 | 5 | 
today-2| 1 | 2 | 5 | 5 | 
today-3| 1 | 1 | 4 | 5 | 

So I want to print a1 and a4 fields that these fields values are constant from past five days.

Is there any possibility to do the above scenario?

0 Karma

adonio
Ultra Champion

I hope i understand your requirement,

try this out anywhere

| makeresults count=1 
| eval data = "today|1|4|8|5;   
 today-1|1|3|6|5; 
 today-2|1|2|5|5 ;
 today-3|1|1|4|5 " 
| makemv delim=";" data 
| mvexpand data 
| rex field=data "(?<date>[^|]+)\|(?<a1>\d+)\|(?<a2>\d+)\|(?<a3>\d+)\|(?<a4>\d+)" 
| stats values(a*) as a* by date 
| rename COMMENT AS "Everything above generates sample data; everything below is your solution" 
| eventstats values(*) as * 
| head 1

hope it helps

echalex
Builder

It's a bit confusing when you combine the words "predict" and "past" in that way, but I assume you try to predict the future from the past.

I can't give you a complete solution as I don't know the base search, but have you considered these options?

1) calculate the standard deviation using stdev, constant values should have stdev=0.

2) calculate the min and the max for the value. If they are the same, the value hasn't changed.

0 Karma

adonio
Ultra Champion

hello there,
can you elaborate on your requirement?
what is it that you would like to accomplish? what is the desired outcome / results?

0 Karma

meenaoleti
New Member

Hi,

I want to predict the constant value from the past five days. for example, if you take share markets, it has so many company shares, so my goal is to find which share markets price is constant for past five days.

in that scenario, if you see above a1,a2,a3 are companies time is today, yesterday and day before yesterday.

0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...