Dashboards & Visualizations

passing variables within a form

DTERM
Contributor

I've trying to pass variables within a form. It does not appear to be working. The code below produces the dropdown. The dropdown works. I need to pass the variable from the dropdown to the rest of the form to produce the charts. Any idea why the variable is not passed or why the charts are not displayed?

Thanks.

<form class="formsearch">

index=MyApp host=host

All |inputlookup zhost.csv | fields + zhost Last 7 days



Top Hosts
index=myapp host=$zhost$ | top serviceName limit="10"
pie
all




Top Hosts
index=myapp host=$zhost$ | top productName limit="10"
bar
all

Tags (1)
0 Karma
1 Solution

cphair
Builder

Hi dterm,

  1. Capitalization matters in Splunk tags. Use populatingSearch, searchTemplate, fieldForValue, and fieldForLabel.
  2. I don't think you need the searchTemplate entry anyway; my search works without it.
  3. Pass $host$ instead of $zhost$ to your search.
  4. I changed the tag search to searchString in your chart section and got a chart to display for my sample data.

Let me know if this helps.

View solution in original post

cphair
Builder

Hi dterm,

  1. Capitalization matters in Splunk tags. Use populatingSearch, searchTemplate, fieldForValue, and fieldForLabel.
  2. I don't think you need the searchTemplate entry anyway; my search works without it.
  3. Pass $host$ instead of $zhost$ to your search.
  4. I changed the tag search to searchString in your chart section and got a chart to display for my sample data.

Let me know if this helps.

DTERM
Contributor

Worked great!! thanks so much!!

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...