Refine your search:

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?

asked 17 Sep '10, 14:24

muebel's gravatar image

muebel ♦
1.0k1117
accept rate: 40%


One Answer:
| 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.

link

answered 17 Sep '10, 14:46

ziegfried's gravatar image

ziegfried ♦
7.2k1315
accept rate: 53%

edited 17 Sep '10, 16:04

Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×1,090
×335

Asked: 17 Sep '10, 14:24

Seen: 363 times

Last updated: 17 Sep '10, 16:04

Copyright © 2005-2012 Splunk, Inc. All rights reserved.