<?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: Set timeout for saved search run in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392424#M70115</link>
    <description>&lt;P&gt;You have few options available in savedsearches.conf like &lt;CODE&gt;dispatch.max_time&lt;/CODE&gt; , &lt;CODE&gt;auto_summarize.max_time&lt;/CODE&gt; as i'm not sure where the delay happens?&lt;/P&gt;

&lt;P&gt;Alerting long runing queries/savedsearches are pretty straight forward. If you have monitoring Console, then the searches are already built in &lt;CODE&gt;en-US/app/splunk_monitoring_console/search_usage_statistics_deployment&lt;/CODE&gt;., especially  "&lt;STRONG&gt;Long-running Searches&lt;/STRONG&gt;".  You can configure alerting for any of those&lt;/P&gt;

&lt;P&gt;Essentially the base query would look like..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=_audit search_group=dmc_group_search_head search_group=* action=search sourcetype=audittrail search_id!="rsa_*") 
| eval search_type=case(match(search_id,"^SummaryDirector_"),"summarization",match(search_id,"^((rt_)?scheduler__|alertsmanager_)"),"scheduled",match(search_id,"\\d{10}\\.\\d+(_[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})?$"),"ad hoc",true(),"other") 
| eval search=if((isnull(savedsearch_name) OR (savedsearch_name == "")),search,savedsearch_name) 
| stats min(_time) as _time, values(user) as user, max(total_run_time) as total_run_time, first(search) as search, first(search_type) as search_type, first(apiStartTime) as apiStartTime, first(apiEndTime) as apiEndTime by search_id, host
| where total_run_time&amp;gt;3600
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 28 May 2019 10:17:10 GMT</pubDate>
    <dc:creator>koshyk</dc:creator>
    <dc:date>2019-05-28T10:17:10Z</dc:date>
    <item>
      <title>Set timeout for saved search run</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392423#M70114</link>
      <description>&lt;P&gt;Hello splunk community!&lt;/P&gt;

&lt;P&gt;Is there any way to add a timeout to a saved search so that it can fail if it runs for too long?&lt;/P&gt;

&lt;P&gt;In case this is not possible, is there another way for me to get notified when a search has been running for longer than it should(let's say, 1 hour).&lt;/P&gt;

&lt;P&gt;Any ideas would be appreciated, thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 09:51:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392423#M70114</guid>
      <dc:creator>kkos94</dc:creator>
      <dc:date>2019-05-28T09:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Set timeout for saved search run</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392424#M70115</link>
      <description>&lt;P&gt;You have few options available in savedsearches.conf like &lt;CODE&gt;dispatch.max_time&lt;/CODE&gt; , &lt;CODE&gt;auto_summarize.max_time&lt;/CODE&gt; as i'm not sure where the delay happens?&lt;/P&gt;

&lt;P&gt;Alerting long runing queries/savedsearches are pretty straight forward. If you have monitoring Console, then the searches are already built in &lt;CODE&gt;en-US/app/splunk_monitoring_console/search_usage_statistics_deployment&lt;/CODE&gt;., especially  "&lt;STRONG&gt;Long-running Searches&lt;/STRONG&gt;".  You can configure alerting for any of those&lt;/P&gt;

&lt;P&gt;Essentially the base query would look like..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=_audit search_group=dmc_group_search_head search_group=* action=search sourcetype=audittrail search_id!="rsa_*") 
| eval search_type=case(match(search_id,"^SummaryDirector_"),"summarization",match(search_id,"^((rt_)?scheduler__|alertsmanager_)"),"scheduled",match(search_id,"\\d{10}\\.\\d+(_[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})?$"),"ad hoc",true(),"other") 
| eval search=if((isnull(savedsearch_name) OR (savedsearch_name == "")),search,savedsearch_name) 
| stats min(_time) as _time, values(user) as user, max(total_run_time) as total_run_time, first(search) as search, first(search_type) as search_type, first(apiStartTime) as apiStartTime, first(apiEndTime) as apiEndTime by search_id, host
| where total_run_time&amp;gt;3600
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 May 2019 10:17:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392424#M70115</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2019-05-28T10:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set timeout for saved search run</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392425#M70116</link>
      <description>&lt;P&gt;Hi @kkos94,&lt;/P&gt;

&lt;P&gt;Definitely, you can limit the max time for a savedsearch, so you're looking for &lt;CODE&gt;dispatch.max_time&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;dispatch.max_time = &amp;lt;integer&amp;gt;
* Indicates the maximum amount of time (in seconds) before finalizing the
  search.
* Defaults to 0.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Official documentation here : &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.6/Admin/Savedsearchesconf"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.6/Admin/Savedsearchesconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You can set that up in either in &lt;CODE&gt;savedsearch.conf&lt;/CODE&gt; file or by going into the advanced setting of your report from the GUI.&lt;/P&gt;

&lt;P&gt;To get a list of all your long running searches you can use a simple search like this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |rest /services/search/jobs splunk_server=local
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;More info here : &lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/508420/identify-searches-that-take-long-time-in-a-sh-clus.html"&gt;https://answers.splunk.com/answers/508420/identify-searches-that-take-long-time-in-a-sh-clus.html&lt;/A&gt;&lt;BR /&gt;
Or you could go to your monitoring console if that is configured, a lot of great info about what's happening on your search heads there.&lt;/P&gt;

&lt;P&gt;Let me know if you need more help!&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 10:23:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392425#M70116</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-28T10:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Set timeout for saved search run</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392426#M70117</link>
      <description>&lt;P&gt;dispatch.max_time did exactly what I needed to make it work.&lt;/P&gt;

&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 10:58:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392426#M70117</guid>
      <dc:creator>kkos94</dc:creator>
      <dc:date>2019-05-28T10:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Set timeout for saved search run</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392427#M70118</link>
      <description>&lt;P&gt;You're welcome !&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 11:00:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392427#M70118</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-28T11:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Set timeout for saved search run</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392428#M70119</link>
      <description>&lt;P&gt;Thanks for your reply!&lt;/P&gt;

&lt;P&gt;Turns out I could modify dispatch.max_time for a specific saved search instead of modifying it in the .conf file.&lt;/P&gt;

&lt;P&gt;Good point on configuring an alert though. I will most definitely need it in the future.&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 11:43:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timeout-for-saved-search-run/m-p/392428#M70119</guid>
      <dc:creator>kkos94</dc:creator>
      <dc:date>2019-05-28T11:43:21Z</dc:date>
    </item>
  </channel>
</rss>

