<?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 retrieve search name by search id in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-search-name-by-search-id/m-p/305933#M91846</link>
    <description>&lt;P&gt;@danielwan, you can use Splunk REST API to pull the search details along with Query, earliest and latest time and other details (you can also view search results). If you want to reuse/rerun the search you can use &lt;CODE&gt;request.search&lt;/CODE&gt;, &lt;CODE&gt;searchEarliestTime&lt;/CODE&gt;, &lt;CODE&gt;searchLatestTime&lt;/CODE&gt; :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/search/jobs/admin_adminsearch_search9_xxxxx.yyyyy
| table sid title eai:acl.app eai:acl.owner request.search searchEarliestTime searchLatestTime custom.dispatch.earliest_time custom.dispatch.latest_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try and confirm. Following is the link to Splunk Documentation for Splunk REST API reference: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTsearch#search.2Fjobs.2F.7Bsearch_id.7D"&gt;http://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTsearch#search.2Fjobs.2F.7Bsearch_id.7D&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 14 Oct 2017 04:29:25 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-10-14T04:29:25Z</dc:date>
    <item>
      <title>How to retrieve search name by search id</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-search-name-by-search-id/m-p/305931#M91844</link>
      <description>&lt;P&gt;my splunk server has high CPU usage and I saw a bunch of splunkd process like below&lt;/P&gt;

&lt;P&gt;search --id=admin_&lt;EM&gt;admin&lt;/EM&gt;&lt;EM&gt;search&lt;/EM&gt;_search9_xxxxx.yyyyy --maxbuckets=0 --ttl=600 --maxout=500000 --maxtime=8640000 --lookups=1 --reduce_freq=10 --user=admin --pro --roles=admin:can_delete:power:user&lt;/P&gt;

&lt;P&gt;These searches seem to run periodically.&lt;/P&gt;

&lt;P&gt;How could I look up scheduled/ad-hoc searches name by these search_ids, and furthermore, to retrieve the search query content?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:14:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-search-name-by-search-id/m-p/305931#M91844</guid>
      <dc:creator>danielwan</dc:creator>
      <dc:date>2020-09-29T16:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve search name by search id</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-search-name-by-search-id/m-p/305932#M91845</link>
      <description>&lt;P&gt;You could use the search id to find the corresponding search folder in the $SPLUNK_HOME/var/run/splunk/dispatch. Inside the search folder, you could find the search content for that particular search. &lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 06:45:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-search-name-by-search-id/m-p/305932#M91845</guid>
      <dc:creator>tlam_splunk</dc:creator>
      <dc:date>2017-10-13T06:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve search name by search id</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-search-name-by-search-id/m-p/305933#M91846</link>
      <description>&lt;P&gt;@danielwan, you can use Splunk REST API to pull the search details along with Query, earliest and latest time and other details (you can also view search results). If you want to reuse/rerun the search you can use &lt;CODE&gt;request.search&lt;/CODE&gt;, &lt;CODE&gt;searchEarliestTime&lt;/CODE&gt;, &lt;CODE&gt;searchLatestTime&lt;/CODE&gt; :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/search/jobs/admin_adminsearch_search9_xxxxx.yyyyy
| table sid title eai:acl.app eai:acl.owner request.search searchEarliestTime searchLatestTime custom.dispatch.earliest_time custom.dispatch.latest_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try and confirm. Following is the link to Splunk Documentation for Splunk REST API reference: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTsearch#search.2Fjobs.2F.7Bsearch_id.7D"&gt;http://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTsearch#search.2Fjobs.2F.7Bsearch_id.7D&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2017 04:29:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-search-name-by-search-id/m-p/305933#M91846</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-10-14T04:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve search name by search id</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-search-name-by-search-id/m-p/305934#M91847</link>
      <description>&lt;P&gt;There's already an accepted answer. However, if that's not working for you, and you have the sid, then you can use &lt;CODE&gt;index=_audit&lt;/CODE&gt; to get to the search. Note the search field has items that you probably don't want, so there's a couple rex commands to boil it down to only the SPL.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_audit search=* action=search search_id=*admin_adminsearch_search9_xxxxx.yyyyy* 
| rex "search='search (?&amp;lt;search&amp;gt;[^\e]+)" 
| rex mode=sed field=search "s/', autojoin=[^\e]+//g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this helps anyone, please upvote the answer!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 20:45:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-search-name-by-search-id/m-p/305934#M91847</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2019-01-25T20:45:55Z</dc:date>
    </item>
  </channel>
</rss>

