All Apps and Add-ons

How to assign global time for the filter in a dashboard

SG
Path Finder

Hi,

I have a dashboard where I have a time range and a filter for the CI branch.

SG_0-1629779511877.png

In the time_range what timings I am taking same timings I wanted to apply for CI branch filter also. As of now, it is taking the last 24hr and I don't see any option to assign the time_range for the CiBranch filter.

These are the options under CiBranch

SG_1-1629783657847.png

 

Thanks,

SG

Labels (1)
Tags (1)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@SG 

Try this.

<form>
	<label>Lighthouse</label>
	<fieldset submitButton="false" autoRun="false">
		<input type="time" token="Lighthouse_Timerange" searchWhenChanged="true">
			<label>time_range</label>
			<default>
				<earliest>-15m</earliest>
				<latest>now</latest>
			</default>
		</input>
		<input type="dropdown" token="CiBranch">
			<label>CiBranch</label>
			<fieldForLabel>CiBranch</fieldForLabel>
			<fieldForValue>CiBranch</fieldForValue>
			<search>
				<query>index=nextgen sourcetype=lighthouse_json datasource=LH | stats count by CiBranch | table CiBranch</query>
				<earliest>$Lighthouse_Timerange.earliest$</earliest>
				<latest>$Lighthouse_Timerange.latest$</latest>
			</search>
		</input>
		</fieldset>
	</form>

 

KV 

View solution in original post

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@SG 

Try by updating dashboard XML and add earliest and latest manually. Like this.

<earliest>$time_range.earliest$</earliest>
<latest>$time_range.latest$</latest>

  

Sample Code:

<fieldset submitButton="true">
    <input type="time" token="time_range">
      <label></label>
      <default>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </default>
    </input>
    <input type="dropdown" token="field2">
      <label>CIBranch</label>
      <fieldForLabel>log_level</fieldForLabel>
      <fieldForValue>log_level</fieldForValue>
      <search>
        <query>index=_internal log_level=* |stats count by log_level</query>
        <earliest>$time_range.earliest$</earliest>
        <latest>$time_range.latest$</latest>
      </search>
    </input>
  </fieldset>

 

KV

0 Karma

SG
Path Finder

Hi KV, 

After updating the XML as suggested my CiBranch dropdown is blocked with a message Could not create search

SG_0-1629800825724.png

My dashboard XML after updating the timings

<form>
  <label>Lighthouse</label>
  <fieldset submitButton="false" autoRun="false">
    <input type="time" token="Lighthouse_Timerange" searchWhenChanged="true">
      <label>time_range</label>
      <default>
        <earliest>-15m</earliest>
        <latest>now</latest>
      </default>
    </input>
    <input type="dropdown" token="CiBranch">
      <label>CiBranch</label>
      <fieldForLabel>CiBranch</fieldForLabel>
      <fieldForValue>CiBranch</fieldForValue>
      <search>
        <query>index=nextgen sourcetype=lighthouse_json datasource=LH 
| stats count by CiBranch 
|  table CiBranch</query>
        <earliest>$time_range.earliest$</earliest>
        <latest>$time_range.latest$</latest>
      </search>
    </input>

 

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@SG 

Try this.

<form>
	<label>Lighthouse</label>
	<fieldset submitButton="false" autoRun="false">
		<input type="time" token="Lighthouse_Timerange" searchWhenChanged="true">
			<label>time_range</label>
			<default>
				<earliest>-15m</earliest>
				<latest>now</latest>
			</default>
		</input>
		<input type="dropdown" token="CiBranch">
			<label>CiBranch</label>
			<fieldForLabel>CiBranch</fieldForLabel>
			<fieldForValue>CiBranch</fieldForValue>
			<search>
				<query>index=nextgen sourcetype=lighthouse_json datasource=LH | stats count by CiBranch | table CiBranch</query>
				<earliest>$Lighthouse_Timerange.earliest$</earliest>
				<latest>$Lighthouse_Timerange.latest$</latest>
			</search>
		</input>
		</fieldset>
	</form>

 

KV 

0 Karma

SG
Path Finder

Hi KV,

This worked perfectly fine. Thanks for the help 🙂

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...