Splunk Search

Splunk 6 :: Form search query is running on form load ??

rakesh_498115
Motivator

Hi All,

Not Sure why this has been running in Splunk 6 like this. I have a form with a timepicker and search button. As soon i open the form the search underlying it is being auto runned. tried setting the attribute autoRun="False" but that doesnt solve my purpose .

It works well in Splunk 5 versions but not on 6 . Is this expected behaviour ?? how can i handle this ?? i dnt want the form to auto load without an user intervention.

My Form Code ::

<form >
    <label>Sample form</label>
    <fieldset   autoRun="false" submitButton="true">    
        <input type="time">
            <default>Last 60 minutes</default>  
        </input>
    </fieldset>
    <row>
        <chart>
            <searchString >index=_internal |stats count by host</searchString>
            <title>Sample Test</title>
            <option name="charting.chart">pie</option>
            <option name="charting.chart.nullValueMode">gaps</option>
            <option name="charting.chart.stackMode">stacked</option>
            <option name="charting.drilldown">all</option>
            <option name="charting.layout.splitSeries">false</option>
            <option name="charting.legend.labelStyle.overflowMode">ellipsisNone</option>
            <option name="charting.legend.placement">right</option>
            <option name="height">200px</option>
            <option name="charting.data.count">0</option>
            <option name="charting.chart.sliceCollapsingThreshold">0</option>
            <option name="charting.chart.showPercent">true</option>
        </chart>
    </row>

</form>

Thanks

Tags (2)

martin_mueller
SplunkTrust
SplunkTrust

You can force the search to rely on the form without changing the search results like this:

<form>
  <fieldset autoRun="false" submitButton="true">    
    <input type="time">
      <default>Last 60 minutes</default>  
    </input>
  </fieldset>
  <row>
    <table>
      <searchString >index=_internal | rename comment as "$earliest$" | stats count by host</searchString>
      <earliest>$earliest$</earliest>
      <latest>$latest$</latest>
    </table>
  </row>
</form>

The reference to a token in the rename causes the search to wait for the form to be submitted, while the rename itself does not affect search performance or search results.

0 Karma

omorgan
Engager

Worked for me. But why did I need this on a form that behaved just fine on splunk 5.0.4?

0 Karma

rakesh_498115
Motivator

yes..i am not relying on any tokens ..but then i dont want the search to run on the form load.. i need the search to run only on user intervention.....how can i acheive this ??

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

That may be related to your search not relying on any tokens from the form.

0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...