<?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: Is it possible to kill or disable long running searches?? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443195#M125754</link>
    <description>&lt;P&gt;Thanks for your reply. But I want to automate it. I don’t want to login and check who is running Long running searches and the disable, I don’t want to do this. I want to write a script or a search which should tell long running searches and if it running for a long time as per my condition just disable or delete that search. Is this possible?&lt;/P&gt;</description>
    <pubDate>Sat, 02 Feb 2019 12:05:05 GMT</pubDate>
    <dc:creator>dbashyam</dc:creator>
    <dc:date>2019-02-02T12:05:05Z</dc:date>
    <item>
      <title>Is it possible to kill or disable long running searches??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443193#M125752</link>
      <description>&lt;P&gt;Hi, is it possible to kill or disable long running searches automatically. For example whenever we hit performance issues we observe that people are running 30 day searches or 10 day searches like that, so we did educate the users not to run long running searches but few listen few don’t so wanted to know whether to it’s possible to kill or warn or disable long running searches?&lt;/P&gt;</description>
      <pubDate>Sat, 02 Feb 2019 08:00:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443193#M125752</guid>
      <dc:creator>dbashyam</dc:creator>
      <dc:date>2019-02-02T08:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to kill or disable long running searches??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443194#M125753</link>
      <description>&lt;P&gt;Hi @dbashyam&lt;/P&gt;

&lt;P&gt;Yes it is possible to kill running searches. Click Activity (top right of screen) &lt;CODE&gt;&amp;gt;&lt;/CODE&gt; Jobs and you can see the running jobs here. Click the square to stop any that you want to kill.&lt;/P&gt;

&lt;P&gt;Hope this solves your problem. &lt;/P&gt;</description>
      <pubDate>Sat, 02 Feb 2019 09:19:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443194#M125753</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-02T09:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to kill or disable long running searches??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443195#M125754</link>
      <description>&lt;P&gt;Thanks for your reply. But I want to automate it. I don’t want to login and check who is running Long running searches and the disable, I don’t want to do this. I want to write a script or a search which should tell long running searches and if it running for a long time as per my condition just disable or delete that search. Is this possible?&lt;/P&gt;</description>
      <pubDate>Sat, 02 Feb 2019 12:05:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443195#M125754</guid>
      <dc:creator>dbashyam</dc:creator>
      <dc:date>2019-02-02T12:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to kill or disable long running searches??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443196#M125755</link>
      <description>&lt;P&gt;The best thing to do would be to enforce limits to stop users doing silly thing. You can set this setting in authorize.conf :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;srchMaxTime = &amp;lt;number&amp;gt;&amp;lt;unit&amp;gt;
* Maximum amount of time that searches of users from this role will be
  allowed to run.
* Once the search has been ran for this amount of time it will be auto
  finalized, If the role
* Inherits from other roles, the maximum srchMaxTime value specified in the
  included roles.
* This maximum does not apply to real-time searches.
* Examples: 1h, 10m, 2hours, 2h, 2hrs, 100s
* Defaults to 100days
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this isn't suitable then yes it is possible to do what you want with searches or a script that calls the API. It would be a lot of work though.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Feb 2019 12:16:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443196#M125755</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-02T12:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to kill or disable long running searches??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443197#M125756</link>
      <description>&lt;P&gt;Download this app and search through the alerts.  There is nothing in Splunk that allows you to automate killing searches so you will have to build that part.  With this app, though, you will have all the searches that you need to find the searches and maybe you can just email people (which splunk can do) and say &lt;CODE&gt;STOP DOING THIS!&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;Alerts for Splunk Admins&lt;/CODE&gt;: &lt;A href="https://splunkbase.splunk.com/app/3796/"&gt;https://splunkbase.splunk.com/app/3796/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Feb 2019 18:55:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443197#M125756</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-02T18:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to kill or disable long running searches??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443198#M125757</link>
      <description>&lt;P&gt;As per woodcock's post the app I have created has ways to detect them, but you won't be able to auto-stop jobs from within Splunk from what I know, you could build an external script.&lt;/P&gt;

&lt;P&gt;However you might be better off using srchMaxTime as per chrisyoungerjds, just keep in mind that it's a subtle message when the search is auto-finalized and it appears in the dispatch/info CSV (and as an info-level message on screen that you have to look for, not a warning). &lt;BR /&gt;
I have a search for this called SearchHeadLevel - Users with auto-finalized searches which is &lt;A href="https://github.com/gjanders/SplunkAdmins/blob/master/default/savedsearches.conf"&gt;here in github&lt;/A&gt; or &lt;A href="https://github.com/gjanders/SplunkAdmins/blob/master/default/savedsearches.conf"&gt;Alerts for SplunkAdmins on SplunkBase&lt;/A&gt; which requires some extra internal logs files to be indexed to find auto-finalization of jobs...&lt;/P&gt;</description>
      <pubDate>Sun, 03 Feb 2019 00:45:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443198#M125757</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2019-02-03T00:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to kill or disable long running searches??</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443199#M125758</link>
      <description>&lt;P&gt;hi dbashyam,&lt;/P&gt;

&lt;P&gt;It would indeed be possible to automate this using a custom alert action, see the docs for more &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/ModAlertsIntro"&gt;https://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/ModAlertsIntro&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;First your search would query the REST endpoint &lt;CODE&gt;/services/search/jobs/&lt;/CODE&gt; to get what ever you define as a &lt;CODE&gt;kill&lt;/CODE&gt; reason. Than you need to make sure the &lt;CODE&gt;sid&lt;/CODE&gt; of the search is available as the result of this search. The reason for this is the alert action can then use &lt;CODE&gt;$job.resultCount$&lt;/CODE&gt; and do a post against the REST API using &lt;CODE&gt;curl&lt;/CODE&gt; like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:pass &lt;A href="https://localhost:8089/services/search/jobs/&amp;lt;sid&amp;gt;/control" target="test_blank"&gt;https://localhost:8089/services/search/jobs/&amp;lt;sid&amp;gt;/control&lt;/A&gt; -d action=cancel
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;More details about this can be found in the docs &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTsearch#search.2Fjobs.2F.7Bsearch_id.7D.2Fcontrol"&gt;https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTsearch#search.2Fjobs.2F.7Bsearch_id.7D.2Fcontrol&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You it is possible, but it takes some work to get there.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 02:36:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-kill-or-disable-long-running-searches/m-p/443199#M125758</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-02-04T02:36:05Z</dc:date>
    </item>
  </channel>
</rss>

