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 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, ...