<?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: Throwing errors in splunk dashboards in Security</title>
    <link>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145401#M14592</link>
    <description>&lt;P&gt;I'm actually more curious to know if there is a way to display the error message.&lt;/P&gt;

&lt;P&gt;Editing time.conf and a dropdown is not a solution in my use case.  &lt;/P&gt;</description>
    <pubDate>Fri, 05 Dec 2014 05:29:47 GMT</pubDate>
    <dc:creator>nibinabr</dc:creator>
    <dc:date>2014-12-05T05:29:47Z</dc:date>
    <item>
      <title>Throwing errors in splunk dashboards</title>
      <link>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145399#M14590</link>
      <description>&lt;P&gt;Is it possible to display an error on a splunk dashboard. &lt;BR /&gt;
Say I want to display an error if the user selects a time range which is greater than n days. Dashboard should not pull the data if it is in this time range, instead it should just show the error message on the panel. &lt;BR /&gt;
I'm on splunk 6.0.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2014 23:38:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145399#M14590</guid>
      <dc:creator>nibinabr</dc:creator>
      <dc:date>2014-12-04T23:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Throwing errors in splunk dashboards</title>
      <link>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145400#M14591</link>
      <description>&lt;P&gt;I'm not sure of a way to limit timeframes like that outside of removing options from perhaps an app specific times.conf maybe.&lt;/P&gt;

&lt;P&gt;The other way I would do it would be hard code a drop down with static time selections options. Then pass those through to the search as earliest &amp;amp; latest parameters.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2014 02:35:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145400#M14591</guid>
      <dc:creator>Lucas_K</dc:creator>
      <dc:date>2014-12-05T02:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Throwing errors in splunk dashboards</title>
      <link>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145401#M14592</link>
      <description>&lt;P&gt;I'm actually more curious to know if there is a way to display the error message.&lt;/P&gt;

&lt;P&gt;Editing time.conf and a dropdown is not a solution in my use case.  &lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2014 05:29:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145401#M14592</guid>
      <dc:creator>nibinabr</dc:creator>
      <dc:date>2014-12-05T05:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Throwing errors in splunk dashboards</title>
      <link>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145402#M14593</link>
      <description>&lt;P&gt;Sounds like the wrong way to go about the issue (i'd rather just stop the users in the first place!) but ... &lt;/P&gt;

&lt;P&gt;Make an eval statement compare now() to earliest. Have another that gets set to your error message if it exceed's a certain number of seconds (604,800 - 7 days). Do the normal search. At the very end output either normal results OR the error message eval-ed earlier.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2014 05:37:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145402#M14593</guid>
      <dc:creator>Lucas_K</dc:creator>
      <dc:date>2014-12-05T05:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Throwing errors in splunk dashboards</title>
      <link>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145403#M14594</link>
      <description>&lt;P&gt;So that is my question. What is the best way to throw an error message ? Following pipe commands shouldn't be executed once the error message is thrown.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2014 14:32:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145403#M14594</guid>
      <dc:creator>nibinabr</dc:creator>
      <dc:date>2014-12-05T14:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Throwing errors in splunk dashboards</title>
      <link>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145404#M14595</link>
      <description>&lt;P&gt;I just developed the technique to do exactly what you want. It is a bit complicated but it works perfectly.&lt;BR /&gt;
You will need to use the SideView Utils library, and add a "Run" button which will run the searches in your dashboard.&lt;BR /&gt;
Set the parameters of this button like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        &amp;lt;module name="Button" layoutPanel="viewHeader"&amp;gt;
            &amp;lt;param name="allowSoftSubmit"&amp;gt;False&amp;lt;/param&amp;gt;
            &amp;lt;param name="allowAutoSubmit"&amp;gt;False&amp;lt;/param&amp;gt;
            &amp;lt;param name="label"&amp;gt;Run&amp;lt;/param&amp;gt;
            &amp;lt;param name="customBehavior"&amp;gt;TimeRangeExceeds7DaysError&amp;lt;/param&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the application.js file which sits in your search head, (I think that's the right path:&lt;BR /&gt;
[home]/etc/apps/search/appserver/static/application.js)&lt;BR /&gt;
 add the following function:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if (typeof(Sideview)!="undefined")
{
Sideview.utils.declareCustomBehavior("TimeRangeExceeds7DaysError", function(buttonModule)
    {
        methodReference = buttonModule.onContextChange.bind(buttonModule);
        buttonModule.onContextChange = function()
        {
            var context = this.getContext();
            var search = context.get("search");
            var range = search.getTimeRange();
            var earliestTime = range.getEarliestTimeTerms();
            var n = 0;
            if( range.isRelative() )
            {
                n = parseInt(earliestTime.toString().substr(1), 10);
            }

            var rexw = /-\d+w/i;
            var rexd = /-\d+d/i;
            var rexh = /-\d+h/i;
            var rexm = /-\d+m/i
            var rexs = /-\d+s/i;

            if(
                range.getDuration() &amp;gt; 604800000 ||
                earliestTime.toString().indexOf("mon") &amp;gt; -1 ||
                earliestTime.toString().indexOf("y") &amp;gt; -1 ||
                (rexw.test(earliestTime) &amp;amp;&amp;amp; n &amp;gt; 1 ) ||
                (rexd.test(earliestTime) &amp;amp;&amp;amp; n &amp;gt; 7) ||
                (rexh.test(earliestTime) &amp;amp;&amp;amp; n &amp;gt; 168) ||
                (rexm.test(earliestTime) &amp;amp;&amp;amp; n &amp;gt; 10080) ||
                (rexs.test(earliestTime) &amp;amp;&amp;amp; n &amp;gt; 604800)
               )
                {
                    alert('This dashboard can only run for a maximum time range of 7 days.\r\nThe Run button will remain hidden until you set a valid time range');
                    this.hide("run_button");
                }
                else
                {
                   this.show("run_button");
                }
            }
        return methodReference();
    });
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this particular case, whenever the time range selected exceeds 7 days, a message pops-up with the text informing the user of the dashboard limitation, and what needs to be done, to enable the "Run" button.&lt;BR /&gt;
Note that the recognition handles both absolute and relative time range selections. This allows users to pick specific time ranges in the past so long as they do not exceed 7 days. And, it will even trigger if time range is set in hours, minutes or seconds but the total amount of time is greater than 7 days.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2015 18:04:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Throwing-errors-in-splunk-dashboards/m-p/145404#M14595</guid>
      <dc:creator>sansay</dc:creator>
      <dc:date>2015-04-27T18:04:48Z</dc:date>
    </item>
  </channel>
</rss>

