Splunk Search

extracting eval for reuse in other searches

SimonKof
New Member

Hi

I have a dashboard which shows metrics for an API. It has a graph for response times, tables for min max average response times etc.

All the searches for these graphs includes the same eval function which groups endpoints where a variable is part of the endpoint. For example this :

index=api
| eval endpoint = replace(endpoint,"user\/\d+\/address","user/{id}/address")
| stats Count, min(executiontime), max(executiontime), avg(executiontime), stdev(executiontime) by endpoint

The above "eval endpoint ....." is used in all the dashboard panel searches.

Can it be extracted so I don't have to maintain the same eval in multiple searches?

Tags (2)
0 Karma

niketn
Legend

@SimonKof, you can create a Calculated field for your eval to reuse the same. Refer to Splunk Documentation: https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/definecalcfields

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

SimonKof
New Member

Hi niketnilay

Thank you for the hint. I can't really understand how calculated fields are used.

When i go to "Calculated fields" -> "Add new" i know what to enter for destination, apply to, named and name. But what should the expression be?

It's difficult for me to find examples on this.

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...