Splunk Search

eval by rows

jiaqya
Builder

i have a table data where in a row has 0's . i need to replace those 0 only for that row

ex:

rowname:data
one:5
two:0
three:0
four:5

in this example i want to change 0 belonging to rowname="two" to a different value, only that row.
how to achieve it..

Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

You should be able to do it like this

... | eval data = if(rowname=="two" AND data==0, replacementValue, data)
| ...
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

You should be able to do it like this

... | eval data = if(rowname=="two" AND data==0, replacementValue, data)
| ...
---
If this reply helps you, Karma would be appreciated.
0 Karma

jiaqya
Builder

Thanks, just one more thing, what if i have more than 1 columns , like data, data 1, date2... etc

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Include the additional fields in the if function.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...