Splunk Search

Create multiple eval fields with wilcards?

jweinstein
Engager

I'm attempting to calculate the deltas between a field and it's historical value. I use a subquery w/ appendcols to return the historical data and it is nicely in the form:

Group, field1, field2, field1_historical, field2_historical

I can create the deltas with:

 | eval field1_delta = field1 - field1_historical
 | eval field2_delta = field2 - field2_historical

This works but I'd like to generalize it:

| eval *_delta = * - *_historical 

but I get the error:

Error in 'eval' command: The expression is malformed. An unexpected character is reached at '* - *_historical'.

Any tips?

Tags (1)

gkanapathy
Splunk Employee
Splunk Employee

Sorry, no. You'll just have to type it out. You can try using a macro to shorten your typing, but you're still going to have to specify the field base names.

dwaddle
SplunkTrust
SplunkTrust

sbsbb, if this is something you need make sure your file an enhancement request about it.

0 Karma

sbsbb
Builder

I need this function too, hopefully it will come with next release of splunk

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

An alternative to typing them out, especially if the field names are dynamic, would be to write your own search command to do this task.

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...