<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to AutoRefresh dashboards only through Javascript in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320932#M20659</link>
    <description>&lt;P&gt;So the good news is I came up with an answer for a AutoRefresh timer purely through JavaScript which was my goal with this post, and the bad news is that I haven't gotten a clue of how Splunk code does it.&lt;/P&gt;

&lt;P&gt;So with the major help of @niketnilay ♦ I came up with this code that gathers all the searches you have in your SimpleXML being the a PostProcess or a Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var intervalId;
$('#AutoRefresh').click(function(){
        if($(this).is(':checked')){
            var seconds = 15;
            intervalId = setInterval(refreshSearches, seconds * 1000);
        }else{
            clearInterval(intervalId);
        }
    });

var searches = getAllSearches();

function getAllSearches(){
        // Find both base and regular searches
        var searches = [];
        var componentsAttributes = mvc.Components._previousAttributes; 
        for(var key in componentsAttributes){
            if(componentsAttributes.hasOwnProperty(key)){
                var attr = componentsAttributes[key];
                if(attr instanceof SearchManager){
                    searches.push(attr.id);
                }
                if(attr instanceof PostProcessManager){
                    searches.push(attr.id);
                }
            }
        }
        return searches;
    }

function refreshSearches(){
        for(var i = 0; i &amp;lt; searches.length; ++i){
            mvc.Components.get(searches[i]).startSearch();
        }
    }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 07 Dec 2017 13:35:04 GMT</pubDate>
    <dc:creator>greggz</dc:creator>
    <dc:date>2017-12-07T13:35:04Z</dc:date>
    <item>
      <title>How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320921#M20648</link>
      <description>&lt;P&gt;I'm trying to set the auto refresh functionality in one of my dashboards trough pure Javascript. In the middle of searching how Splunk does this, I converted my dashboard to Html with and withouth the &lt;STRONG&gt;&lt;EM&gt;refresh&lt;/EM&gt;&lt;/STRONG&gt; property in the &lt;STRONG&gt;form&lt;/STRONG&gt; element. I noticied the only visible change in both Html's was that the one with the refresh property had one extra line of code named &lt;STRONG&gt;setTimeout('location.reload();', seconds x 1000)&lt;/STRONG&gt;. I added this line to my JS, but it refreshed me the whole page instead of only the panels like the refresh property does. Anyone know if what I'm trying to do is achievable ?&lt;/P&gt;

&lt;P&gt;This is how I was doing it&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$('#AutoRefresh').click(function(){
        if($(this).is(':checked')){
            var seconds = 15;
            setTimeout('location.reload();', seconds * 1000);
        }else{
            clearTimeout();
        }
    });
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Dec 2017 16:48:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320921#M20648</guid>
      <dc:creator>greggz</dc:creator>
      <dc:date>2017-12-05T16:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320922#M20649</link>
      <description>&lt;P&gt;@greggz, What you are looking at is form or dashboard &lt;CODE&gt;refresh&lt;/CODE&gt; which refreshes the entire dashboard.&lt;/P&gt;

&lt;P&gt;If you want to refresh just a single panel, you will have to set &lt;CODE&gt;&amp;lt;refresh&amp;gt;&lt;/CODE&gt; option for the search powering the respective panel&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Following is a run anywhere search example in Simple XML with 1 minute refresh &lt;CODE&gt;&amp;lt;refresh&amp;gt;1m&amp;lt;/refresh&amp;gt;&lt;/CODE&gt;:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd log_level=*
| timechart count by log_level
| table _time INFO WARN ERROR
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
          &amp;lt;refresh&amp;gt;1m&amp;lt;/refresh&amp;gt;
          &amp;lt;refreshType&amp;gt;delay&amp;lt;/refreshType&amp;gt;
        &amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Following is corresponding HTML code with &lt;CODE&gt;"refresh": "1m"&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var search1 = new SearchManager({
            "id": "search1",
            "refresh": "1m",
            "earliest_time": "-24h@h",
            "sample_ratio": 1,
            "status_buckets": 0,
            "cancelOnUnload": true,
            "refreshType": "delay",
            "latest_time": "now",
            "search": "index=_internal sourcetype=splunkd log_level=* | timechart count by log_level | table _time INFO WARN ERROR",
            "app": utils.getCurrentApp(),
            "auto_cancel": 90,
            "preview": true,
            "tokenDependencies": {
            },
            "runWhenTimeIsUndefined": false
        }, {tokens: true, tokenNamespace: "submitted"});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Dec 2017 06:19:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320922#M20649</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-06T06:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320923#M20650</link>
      <description>&lt;P&gt;Thanks for your answer, so for me to make this work in Javascript, I would need to iterate trough every SearchManager in the dashboard and add them a refresh option ?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 08:58:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320923#M20650</guid>
      <dc:creator>greggz</dc:creator>
      <dc:date>2017-12-06T08:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320924#M20651</link>
      <description>&lt;P&gt;If you want to refresh all your Panels then your previous solution of entire dashboard refresh would be better. Could you please confirm whether you want individual panel or all?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 09:11:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320924#M20651</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-06T09:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320925#M20652</link>
      <description>&lt;P&gt;I want all to be refreshed. My first solution was reloading the entire page, like a normal refresh would. Splunk's refresh by some magic only refreshes the panels.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 09:16:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320925#M20652</guid>
      <dc:creator>greggz</dc:creator>
      <dc:date>2017-12-06T09:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320926#M20653</link>
      <description>&lt;P&gt;@niketnilay ♦ How to prevent the page from reloading ? Splunk prop "refresh" in  only refreshes the searches, it does not reload the entire page&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 12:06:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320926#M20653</guid>
      <dc:creator>greggz</dc:creator>
      <dc:date>2017-12-06T12:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320927#M20654</link>
      <description>&lt;P&gt;@greggz, I think the reason is with JavaScript function &lt;CODE&gt;location.reload()&lt;/CODE&gt; which is forcing a POST rather than receiving dashboard from cache.&lt;/P&gt;

&lt;P&gt;Since you want only panel searches to re-run not the entire dashboard, you will either have to use Splunk JS Stack to set the &lt;CODE&gt;refresh&lt;/CODE&gt; attribute for all &lt;CODE&gt;Search Managers&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;But looking at your code seems like you want refresh to execute on click of a button. Can you try the following run anywhere Simple XML dashboard based on Splunk's _internal index. &lt;/P&gt;

&lt;P&gt;This dashboard initializes a dummy token &lt;CODE&gt;forceRefreshPanel&lt;/CODE&gt; in the &lt;CODE&gt;&amp;lt;init&amp;gt;&lt;/CODE&gt; section (for page load. PS: It will not work with HTML dashboard)&lt;/P&gt;

&lt;P&gt;Then I have included it in all searches as token as dummy value &lt;CODE&gt;| eval dummy="$forceRefreshPanel$" | fields - dummy&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;There is a &lt;CODE&gt;Checkbox&lt;/CODE&gt; which unset's the dummy token to reset search query and then sets is back for query to complete. You can use HTML Panel to add button to do this and implement token set/unset in JavaScript for neat solution. I have kept it Simple XML for demo/clarification &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3953iD040F297821A0E11/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Refresh Panel&amp;lt;/label&amp;gt;
  &amp;lt;init&amp;gt;
    &amp;lt;set token="forceRefreshPanel"&amp;gt;true&amp;lt;/set&amp;gt;
  &amp;lt;/init&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="tokTime" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-60m@m&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Splunk Log Levels&amp;lt;/title&amp;gt;
      &amp;lt;input type="checkbox" token="tokRefresh" id="refreshCheck"&amp;gt;
        &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
        &amp;lt;choice value="refresh"&amp;gt;Refresh&amp;lt;/choice&amp;gt;
        &amp;lt;change&amp;gt;
          &amp;lt;condition value="refresh"&amp;gt;
            &amp;lt;unset token="forceRefreshPanel"&amp;gt;&amp;lt;/unset&amp;gt;
            &amp;lt;unset token="form.tokRefresh"&amp;gt;&amp;lt;/unset&amp;gt;
            &amp;lt;set token="forceRefreshPanel"&amp;gt;true&amp;lt;/set&amp;gt;
          &amp;lt;/condition&amp;gt;
        &amp;lt;/change&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd log_level=*
| timechart count by log_level
| table _time INFO WARN ERROR
| eval dummy="$forceRefreshPanel$"
| fields - dummy&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.overflowMode"&amp;gt;ellipsisNone&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.rotation"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleX.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY2.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.enabled"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.scale"&amp;gt;inherit&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;column&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMaximumSize"&amp;gt;50&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMinimumSize"&amp;gt;10&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleSizeBy"&amp;gt;area&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.nullValueMode"&amp;gt;gaps&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.overlayFields"&amp;gt;INFO&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.showDataLabels"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.sliceCollapsingThreshold"&amp;gt;0.01&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.stackMode"&amp;gt;stacked&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.style"&amp;gt;shiny&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries.allowIndependentYRanges"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.labelStyle.overflowMode"&amp;gt;ellipsisMiddle&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.mode"&amp;gt;standard&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.placement"&amp;gt;bottom&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.lineWidth"&amp;gt;2&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Splunk Components&amp;lt;/title&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd log_level=*
| timechart count by component useother=f usenull=f limit=10
| eval dummy="$forceRefreshPanel$"
| fields - dummy&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.overflowMode"&amp;gt;ellipsisNone&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.rotation"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleX.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY2.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.enabled"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.scale"&amp;gt;inherit&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;column&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMaximumSize"&amp;gt;50&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMinimumSize"&amp;gt;10&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleSizeBy"&amp;gt;area&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.nullValueMode"&amp;gt;gaps&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.overlayFields"&amp;gt;Metrics&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.showDataLabels"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.sliceCollapsingThreshold"&amp;gt;0.01&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.stackMode"&amp;gt;stacked&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.style"&amp;gt;shiny&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries.allowIndependentYRanges"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.labelStyle.overflowMode"&amp;gt;ellipsisMiddle&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.mode"&amp;gt;standard&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.placement"&amp;gt;bottom&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.lineWidth"&amp;gt;2&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 13:08:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320927#M20654</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-06T13:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320928#M20655</link>
      <description>&lt;P&gt;@niketnilay ♦ Thank you for taking time to answer me!! but I don't think this solution is pratical enough for my case. My case scenario is one which I can't modify the simpleXML. We want to be able to include a .Js file in a set of dashboards, therefore our solution must be generic to be able to run in every dashboard. I can't go around and change the query's by adding the &lt;STRONG&gt;eval dummy = $refresh$&lt;/STRONG&gt; option. Can't I just run trough every SearchManager in the dashboard and add them the "refresh" property ? I'm trying to find any docs on it but I've had no success.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 13:59:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320928#M20655</guid>
      <dc:creator>greggz</dc:creator>
      <dc:date>2017-12-06T13:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320929#M20656</link>
      <description>&lt;P&gt;@greggz, one Question is &lt;CODE&gt;#Autorefresh&lt;/CODE&gt; a Splunk Input created via Splunk JS Stack or HTML input forced through jQuery? Since you want this JS script to be independent of the Dashboard, I just wanted to confirm?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;You can use &lt;CODE&gt;startSearch()&lt;/CODE&gt; method for selected Search Manager to forcefully start a search based on button click using JavaScript and SplunkJS Stack.&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/DocumentationStatic/WebFramework/1.0/compref_searchmanager.html"&gt;http://docs.splunk.com/DocumentationStatic/WebFramework/1.0/compref_searchmanager.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/DocumentationStatic/WebFramework/1.0/compref_searchbar.html"&gt;http://docs.splunk.com/DocumentationStatic/WebFramework/1.0/compref_searchbar.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Can you try adding the following code to your HTML to see? Following assumes, you have not created your own Search IDs (or else you will need to add them manually i.e. for example in &lt;CODE&gt;post-processing&lt;/CODE&gt;). By default Splunk assigns search ids in incremental order i.e. &lt;CODE&gt;search1, search2, search3...&lt;/CODE&gt; I am trying to run the loop 10 times but it will exit the moment a search ID is not found.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;I am trying to use this because I do not know if there is a built in &lt;CODE&gt;mvc.Components&lt;/CODE&gt; function to get &lt;CODE&gt;all Search IDs from Search Managers in a Dashboard&lt;/CODE&gt; using Splunk JS Stack. @rjthibod, @jeffland &lt;CODE&gt;are you aware of any such Splunk JS stack function&lt;/CODE&gt;?&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    $('#Autorefresh').on("click",function(){
        for(i=1;i&amp;lt;10;i++)
        {
            var search=mvc.Components.get("search"+i);
            if(search===undefined){
                break;
            }   
            else{
                    search.startSearch();
            }
        }
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3954iEBD290FA98BFA6E9/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Following is run anywhere code for Simple XML dashboard with JavaScript Extension:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Simple XML Dashboard&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form script="autorefresh_panels.js"&amp;gt;
  &amp;lt;label&amp;gt;Refresh Panel JavaScript and startSearch&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="tokTime" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-60m@m&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Splunk Log Levels&amp;lt;/title&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;a id="Autorefresh" class="btn"&amp;gt;Refresh &amp;amp;#8635;&amp;lt;/a&amp;gt;
      &amp;lt;/html&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd log_level=*
| timechart count by log_level
| table _time INFO WARN ERROR
| fields - dummy&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.overflowMode"&amp;gt;ellipsisNone&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.rotation"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleX.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY2.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.enabled"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.scale"&amp;gt;inherit&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;column&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMaximumSize"&amp;gt;50&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMinimumSize"&amp;gt;10&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleSizeBy"&amp;gt;area&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.nullValueMode"&amp;gt;gaps&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.overlayFields"&amp;gt;INFO&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.showDataLabels"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.sliceCollapsingThreshold"&amp;gt;0.01&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.stackMode"&amp;gt;stacked&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.style"&amp;gt;shiny&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries.allowIndependentYRanges"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.labelStyle.overflowMode"&amp;gt;ellipsisMiddle&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.mode"&amp;gt;standard&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.placement"&amp;gt;bottom&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.lineWidth"&amp;gt;2&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Splunk Components&amp;lt;/title&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd log_level=*
| timechart count by component useother=f usenull=f limit=10&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.overflowMode"&amp;gt;ellipsisNone&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.rotation"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleX.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY2.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.enabled"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.scale"&amp;gt;inherit&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;column&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMaximumSize"&amp;gt;50&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMinimumSize"&amp;gt;10&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleSizeBy"&amp;gt;area&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.nullValueMode"&amp;gt;gaps&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.overlayFields"&amp;gt;Metrics&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.showDataLabels"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.sliceCollapsingThreshold"&amp;gt;0.01&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.stackMode"&amp;gt;stacked&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.style"&amp;gt;shiny&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries.allowIndependentYRanges"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.labelStyle.overflowMode"&amp;gt;ellipsisMiddle&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.mode"&amp;gt;standard&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.placement"&amp;gt;bottom&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.lineWidth"&amp;gt;2&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;JavaScript file - &lt;CODE&gt;autorefresh_panels.js&lt;/CODE&gt;&lt;/STRONG&gt;&lt;BR /&gt;
This file needs to be placed under the Splunk App's static folder which is typically: &lt;CODE&gt;$SPLUNK_HOME$/etc/apps/&amp;lt;YourAppName&amp;gt;/appserver/static&lt;/CODE&gt;&lt;BR /&gt;
Also, adding static file implies, for the changes to reflect, Splunk needs to be restarted/refreshed/bumped and also browser history may need to be cleaned up.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    "splunkjs/mvc",
    "jquery",
    "splunkjs/mvc/searchmanager",
    "splunkjs/mvc/simplexml/ready!"
], function(
            mvc,
            $
            ){
        $('#Autorefresh').on("click",function(){
            for(i=1;i&amp;lt;10;i++)
            {
                var search=mvc.Components.get("search"+i);
                if(search===undefined){
                    break;
                }   
                else{
                        search.startSearch();
                }
            }
        });
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Dec 2017 18:44:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320929#M20656</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-06T18:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320930#M20657</link>
      <description>&lt;P&gt;@niketnilay ♦ Thank you again for your replies! Regarding your first question, I'm forcing it via Html and reference it with Jquery, but I think that won't be a problem with this implementation. This seems to be able to work indeed, but this is a single refresh. To mimic the Auto refresh, I guess I should add the &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;setInterval( search.startSearch() , numberOfSeconds);&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;But yes I think this is the way! I'll mark it as the right answer as soon as I'll be able to test it.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 19:45:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320930#M20657</guid>
      <dc:creator>greggz</dc:creator>
      <dc:date>2017-12-06T19:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320931#M20658</link>
      <description>&lt;P&gt;@greggz, I purposely made it single time refresh, because in your post you had created it for &lt;CODE&gt;click&lt;/CODE&gt; event. So, I assumed you want Panels to be refreshed each time a button is clicked. Thanks for your explanation that it was only for your testing &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Try with &lt;CODE&gt;setTimeout()&lt;/CODE&gt;and confirm! All the best!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 21:02:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320931#M20658</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-06T21:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320932#M20659</link>
      <description>&lt;P&gt;So the good news is I came up with an answer for a AutoRefresh timer purely through JavaScript which was my goal with this post, and the bad news is that I haven't gotten a clue of how Splunk code does it.&lt;/P&gt;

&lt;P&gt;So with the major help of @niketnilay ♦ I came up with this code that gathers all the searches you have in your SimpleXML being the a PostProcess or a Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var intervalId;
$('#AutoRefresh').click(function(){
        if($(this).is(':checked')){
            var seconds = 15;
            intervalId = setInterval(refreshSearches, seconds * 1000);
        }else{
            clearInterval(intervalId);
        }
    });

var searches = getAllSearches();

function getAllSearches(){
        // Find both base and regular searches
        var searches = [];
        var componentsAttributes = mvc.Components._previousAttributes; 
        for(var key in componentsAttributes){
            if(componentsAttributes.hasOwnProperty(key)){
                var attr = componentsAttributes[key];
                if(attr instanceof SearchManager){
                    searches.push(attr.id);
                }
                if(attr instanceof PostProcessManager){
                    searches.push(attr.id);
                }
            }
        }
        return searches;
    }

function refreshSearches(){
        for(var i = 0; i &amp;lt; searches.length; ++i){
            mvc.Components.get(searches[i]).startSearch();
        }
    }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Dec 2017 13:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320932#M20659</guid>
      <dc:creator>greggz</dc:creator>
      <dc:date>2017-12-07T13:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320933#M20660</link>
      <description>&lt;P&gt;@greggz thanks for posting this. Now I have learnt how to find Splunk component &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2017 15:29:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320933#M20660</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-07T15:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to AutoRefresh dashboards only through Javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320934#M20661</link>
      <description>&lt;P&gt;@niketnilay ♦ My pleasure! Btw you migth not need to get the PostProcessManagers, cause I think when you start the Parent Search , the children searches will automattically start aswell. All the best &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2017 15:53:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-AutoRefresh-dashboards-only-through-Javascript/m-p/320934#M20661</guid>
      <dc:creator>greggz</dc:creator>
      <dc:date>2017-12-07T15:53:52Z</dc:date>
    </item>
  </channel>
</rss>

