Refine your search:

Hi ,

I have created a form with a dropdown box and a textbox ..when a change a value in dropdown box my query should change.For example i have three queries like this

Query 1 : sourcetype="X" | somelogic | where cond = $search parameter $ Query 2 : sourcetype="Y" | somelogic | where cond = $search parameter $ Query 3 : sourcetype="Z" | somelogic | where cond = $search parameter $

where search parameter is the value given in the textbox.my requirement i have three values in the dropbox say A,B,C.if i select A Query1 should excute with the value given in the textbox as searchparameter..How can i do this..

Please help me on this..

thanx

asked 31 May '12, 12:16

rakesh_498115's gravatar image

rakesh_498115
6571310
accept rate: 0%

Can you paste in the code that you have so far?

(31 May '12, 13:47) araitz ♦

actually i dnt have any code ..i have the queries ready ..and need to implement in this way..checked all the examples in the splunkbase but couldnt get any solution.

(01 Jun '12, 02:41) rakesh_498115

One Answer:

You could probably use a subsearch to choose sourcetype like this:

* [search * | head 1 | eval sourcetype=case(cond=$paramvalue1$,"X",cond=$paramvalue2$,"Y",cond=$paramvalue3$,"Z") | fields sourcetype] | somelogic | where cond=$paramvalue$
link

answered 01 Jun '12, 03:03

Ayn's gravatar image

Ayn
25.1k3717
accept rate: 41%

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:

×35
×35

Asked: 31 May '12, 12:16

Seen: 356 times

Last updated: 01 Jun '12, 03:03

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