Dashboards & Visualizations

prebuilt panels - condition the behaviour

gravid
New Member

Hi,

I'm having a predefined panel which I want to reuse in the same dashboard.
Each "instantiation" of the panel (using panel ref=panel_name) needs to do a slight different search.

Is there a way to control it?
something like:
panel ref="my_panel" myVar="hello"

in the predefined panel:
panel
query

      index="playground4" Name="ABC*" 
      | eval FACTOR=$my_var  | rest of the code...


      query

panel

0 Karma

thambisetty
SplunkTrust
SplunkTrust

Hi @gravid,

I think you are looking for base search.

what is base search?
Base is search something master search and this search results can be used in multiple panels by using the id of it.
Below is the sample code shows that search id="base" results will be used in panel1.

<form>
</input>
    <input type="text" token="my_var" searchWhenChanged="true">
      <label>Factor</label>
      <default>*</default>
    </input>
 <search id="base">
    <query>index="playground4" Name="ABC*"  FACTOR=$my_var$
<earliest>$earliest$</earliest>
    <latest>$latest$</latest>
  </search>
<row>
    <panel>
      <chart>
        <title>panel1</title>
        <search base="base">
          <query>| additional query</query>
        </search>
      </chart>
    </panel>
  </row>
</form>
————————————
If this helps, give a like below.
0 Karma

gravid
New Member

Hi thambisetty,

Thx for your answer.

I actually use base search in my code. I just sent a portion of my code so it was not part of it.
I need to create a dashboard with multiple charts which are exactly the same, except for 2 variables taken from dropdown lists.

My intention was to mimic a some looping here.
I dont want to write and maintain exactly the same code (almost) on many rows and panels, so I thought to use a prebuilt panel that can get a value as an input to a var used in the panel.

Any idea how to achieve loop in the XML code?

Thx again
Guy

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...