Refine your search:

I am having trouble getting my form search to bring back anything. The xml is accepted by splunk but the search won't bring back anything. It always says 0. here is the xml code...

 <form>
 <label>My Search Engine</label>
 <searchTemplate>"$SearchHere$" | head 250</searchTemplate>
 <earliestTime>-30d</earliestTime>
 <latestTime>-0d</latestTime>
 <html>
 Enter a sourcetype in the field below and this view will pull back the most recent   100      events from the metrics log concerning that sourcetype.
 </html>
 <fieldset>
 <input type="text" token="username">
 <label>Enter a user name</label>
 <default>Last 24 Hours</default>
 </input>
 </fieldset>
 <row>
 <chart>
 <title>User logins</title>
 <option name="charting.chart">pie</option>
 </chart>
 <event>
 <title>Matching events</title>
 <fields>_raw</fields>
 <option name="count">250</option>
 </event>
 </row>
 </form>

asked 27 May '10, 18:02

riderofyamaha's gravatar image

riderofyamaha
1118
accept rate: 0%


2 Answers:

Hmm. You example looks like you tried 5 different things and none of it is consistent. Here are some things to fix up:

  • Your HTML message mentions "sourcetypes" but nothing else seems to refer to them.
  • Your default value for "username" looks like a value for a time range
  • You are trying to build a <chart> without using a chart or timechart command in your search.
  • You have a mysterious variable named $SearchHere$ which you aren't actually setting up as an input anywhere.

I second hiddenkirby's suggestion to checkout the ui-examples app.

Another approach could be to build a few dashboards using splunk's dashboard building wizard and review the XML it generates for you. This is not a bad way to get started. If you haven't walked though the forms how intro in the docs, that's another good place to start:

link

answered 27 May '10, 21:19

Lowell's gravatar image

Lowell ♦
11.1k91289
accept rate: 41%

edited 27 May '10, 21:26

What happens when you remove the doublequotes in your searchTemplate?

What happens if you add a specific index?

index="myindex" username=$username$ | head 250

Downlaod ui-examples app from splunkbase and install it.

Look at the simplified xml -> inverted flow example.

link

answered 27 May '10, 18:31

hiddenkirby's gravatar image

hiddenkirby
3674325
accept rate: 14%

edited 27 May '10, 22:24

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

Asked: 27 May '10, 18:02

Seen: 1,490 times

Last updated: 27 May '10, 22:24

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