Knowledge Management

Data model how to use a calculated field for a new eval expression?

jadengoho
Builder

I am trying to create a new field using the regex i create.
I created a regex first in the first level
now how can i use that regex /calculated field in a eval expression ?

0 Karma

p_gurav
Champion
0 Karma

jadengoho
Builder

I see this : https://answers.splunk.com/answers/329479/is-there-a-way-for-one-calculated-field-to-pull-da.html#an...

but its way back 2015 , does new splunk can do this now ?

0 Karma

hortonew
Builder

Yea, you can utilized the extracted field from rex, in your next eval. The following should output 1, 2

| makeresults | eval field1="test1" | rex field=field1 "test(?<fieldcount>\d)" | eval field2=fieldcount+1 | table fieldcount, field2

0 Karma

jadengoho
Builder

would this apply in a data model ?

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...