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!

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...

Updated Data Management and AWS GDI Inventory in Splunk Observability

We’re making some changes to Data Management and Infrastructure Inventory for AWS. The Data Management page, ...

Introducing the Splunk Community Dashboard Challenge!

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