Splunk Search

On the Fly KV Generation for Search Language Testing

muebel
SplunkTrust
SplunkTrust

I am hacking away at some searches, and having some difficulties with strings and ints. I would like to set up some variables to do some testing. Initially, I tried:

| eval blah="1"

hoping to have the field blah to work with, and do stuff like isnum() and isstring() and tostring() etc

This doesn't look like the way to pull it off. Is there a way to get key value pairs into the pipeline without actually running a search?

Tags (2)
1 Solution

ziegfried
Influencer
| stats count | eval blah="1"

This is because the eval command performs its calculations for each row in the result and when using | eval foo="123" its operating on a result with 0 rows. Simply prefixing it with | stats count generates a row and the eval expression operates on this row.

View solution in original post

ziegfried
Influencer
| stats count | eval blah="1"

This is because the eval command performs its calculations for each row in the result and when using | eval foo="123" its operating on a result with 0 rows. Simply prefixing it with | stats count generates a row and the eval expression operates on this row.

Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

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

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