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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...