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