Splunk Search

Can I use splunk's time range in a calculation?

markin0s
New Member

I have a question.
Can I use splunk's time picker in a calculation?

Now he always searches for 30 days
|eval minPercentage=round((duration/2592000)*100,1)

I would like to replace 2592000.1 with month to date and 1 with last month.

index=onboarding sourcetype="ping:output"
| xmlkv
| search succeed_count=* description=""
| transaction ip_adress startswith=succeed_count=1
|search eventcount!=1
| eval Notification=case(duration>=14400,"Not available for more than 4 hours",1=1,"Sign up")
|search Notification!= "Sign up"
|eval duration=duration-14400
| append [| makeresults |eval duration="0" ]
|stats sum(duration) as duration
|eval minPercentage=round((duration/
2592000*)*100,1)
|eval percentage=100-minPercentage
|fields percentage

Tags (1)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...