Refine your search:

3
3

(Copied from a legacy Splunk Forums post by user bpf)

Hello

I have the following problem:

  • I have a Name. With this Name I search the clID first.
  • Then I will search in several sources this clID-Value.

I have the following search:

index="myindex" [ index="myindex" host="myhost" <Name> | top limit=1 clID | fields + clID ]

The subsearch returns something like: ( (clID="0050834ja") )

Now, my problem is, that in the different sources the clID-Value appears in different fields. Is there a way that the subsearch return only the field-Value ("0050834ja") without the fieldname?

Thanks for your help. Bruno

asked 09 Apr '10, 15:45

gkanapathy's gravatar image

gkanapathy ♦
26.2k1622
accept rate: 42%


One Answer:

Yes. Do this:

index=myindex [ index=myindex host=myhost MyName | top limit=1 clID | fields + clID | rename clID as search ]

If the field is named search (or query) the field name will be dropped and the subsearch (or technically, the implicit |format command at the end of the subsearch) will drop the field name and return ( ( 0050834ja ) ). Multiple results will return, e.g., ( ( value1 ) OR ( value2 ) OR ( value3 ) ).

This is a special case only when the field is named either "search" or "query". Renaming your fields to anything else will make the subsearch use the new field names.

link

answered 09 Apr '10, 15:48

gkanapathy's gravatar image

gkanapathy ♦
26.2k1622
accept rate: 42%

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:

×333
×130

Asked: 09 Apr '10, 15:45

Seen: 969 times

Last updated: 09 Apr '10, 15:48

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