Splunk Search

How to exclude a field in foreach?

HeinzWaescher
Motivator

Hi,

is it possible to exclude one specific field in the foreach command?
Currently it looks like this, but I want to exclude the "size" field here:

| foreach * [eval <<FIELD>>=round('<<FIELD>>'/size*100, 2)]

Cheers
Heinz

0 Karma
1 Solution

javiergn
Super Champion

Try this:

| foreach * [eval <<FIELD>>=if("<<FIELD>>" == "size", size, round('<<FIELD>>'/size*100, 2))]

View solution in original post

javiergn
Super Champion

Try this:

| foreach * [eval <<FIELD>>=if("<<FIELD>>" == "size", size, round('<<FIELD>>'/size*100, 2))]

HeinzWaescher
Motivator

Awesome, thanks a lot!

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...