<?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: Automate backfill script in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233633#M69413</link>
    <description>&lt;P&gt;Cool, thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 19 Aug 2016 12:18:21 GMT</pubDate>
    <dc:creator>mwdbhyat</dc:creator>
    <dc:date>2016-08-19T12:18:21Z</dc:date>
    <item>
      <title>Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233622#M69402</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I need to automate the backfill script for about 60 searches.. Is there a way to put all 60 searches in a single script and then make them run one by one(wait until previous one is done before continuing to next)&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 11:14:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233622#M69402</guid>
      <dc:creator>mwdbhyat</dc:creator>
      <dc:date>2016-08-19T11:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233623#M69403</link>
      <description>&lt;P&gt;You could have the backfill command run then have it produce an exit code when it's complete which will then trigger the next backfill to begin &lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 11:19:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233623#M69403</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2016-08-19T11:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233624#M69404</link>
      <description>&lt;P&gt;Thanks - noob question but could you give me an example of how this would work?&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;starting script code ?&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;./splunk cmd python fill_summary_index.py -app APPNAME -name SEARCHNAME -et -12w@w -lt now -dedup true &lt;/P&gt;

&lt;P&gt;exit script code ?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:39:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233624#M69404</guid>
      <dc:creator>mwdbhyat</dc:creator>
      <dc:date>2020-09-29T10:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233625#M69405</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/180565"&gt;@mwdbhyat&lt;/a&gt;,&lt;/P&gt;

&lt;P&gt;fill_summary_index.py takes an argument called &lt;CODE&gt;-j &amp;lt;integer&amp;gt;&lt;/CODE&gt; (max &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; this will decide the concurrency. If not specified , one search backfill is executed at a time. As far as running automated for 60 searches, are they all in a same app? Can you move them to xyz app (just 60 and nothing more) and use &lt;CODE&gt;-app xyz -name *&lt;/CODE&gt; or get creative pragmatically where you have an array and run it through some sort of controlled loop.&lt;/P&gt;

&lt;P&gt;What i feel tricky is the time frame you need to select if all these 60 have different windows. I do the backfills quite often and i have wrapped them in shell scripts and tied them up to cron  based on their original schedules (offcourse -dedup true)&lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Raghav&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:42:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233625#M69405</guid>
      <dc:creator>Raghav2384</dc:creator>
      <dc:date>2020-09-29T10:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233626#M69406</link>
      <description>&lt;P&gt;Hi Raghav,&lt;/P&gt;

&lt;P&gt;Thanks for the reply.. It is for 1 app yes. Basically I have created a txt file with all 60 searches listed with the ./backfill command as above. Initially just to add in previous 12w worth of data I just want it to do the automated backfill once. So if I just run my txt file with 60 searches listed, will it just do them 1 at a time until the whole list is done ?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 11:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233626#M69406</guid>
      <dc:creator>mwdbhyat</dc:creator>
      <dc:date>2016-08-19T11:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233627#M69407</link>
      <description>&lt;P&gt;Assuming that you're working on a Linux machine.. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://bencane.com/2014/09/02/understanding-exit-codes-and-how-to-use-them-in-bash-scripts/"&gt;http://bencane.com/2014/09/02/understanding-exit-codes-and-how-to-use-them-in-bash-scripts/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This example will require you to create multiple scripts and one script will trigger the next script after it completes.. Alternatively if you want a single script, you could use a &lt;CODE&gt;WAIT&lt;/CODE&gt; for input and have the script wait until the backfill is complete which will start the next backfill.. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/bin/bash

./splunk cmd python fill_summary_index.py -app APPNAME -name SEARCHNAME -et -12w@w -lt now -dedup   true

if [ $? -eq 0 ]
then
  echo "Successfully ran backfill"
  exit 0
else
  echo "Errors running backfill" &amp;gt;&amp;amp;2
  exit 1
fi
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here's another method of running which will look at the process ID and execute on a loop until all the backfills run &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;pid=$(ps -opid= -C your_script_name)
while [ -d /proc/$pid ] ; do
    sleep 1
done &amp;amp;&amp;amp; ./your_other_script
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Aug 2016 11:54:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233627#M69407</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2016-08-19T11:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233628#M69408</link>
      <description>&lt;P&gt;Correct, keeping the volume of searches aside, that script fill_summary_index.py is designed to execute one search at a time unless asked it to do more.&lt;/P&gt;

&lt;P&gt;example: &lt;BR /&gt;
    ./splunk cmd python fill_summary_index.py -app xyz -name * -dedup true -showprogress true -et -7d -lt now -j 8 -owner admin &lt;BR /&gt;
will run / try to run 8 searches at a time (Whole different story if you do not have 8 cores on you search head....rule is 1 search per core). &lt;BR /&gt;
&amp;amp; if you just not mention -j argument, it will run one search , waits for it to finish and then move on to the next.&lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Raghav&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:42:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233628#M69408</guid>
      <dc:creator>Raghav2384</dc:creator>
      <dc:date>2020-09-29T10:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233629#M69409</link>
      <description>&lt;P&gt;Sweet, thanks a lot!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 11:56:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233629#M69409</guid>
      <dc:creator>mwdbhyat</dc:creator>
      <dc:date>2016-08-19T11:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233630#M69410</link>
      <description>&lt;P&gt;Awesome, thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 11:56:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233630#M69410</guid>
      <dc:creator>mwdbhyat</dc:creator>
      <dc:date>2016-08-19T11:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233631#M69411</link>
      <description>&lt;P&gt;How would I pass the admin username in just once with creds as it is asking me for each search to type in the username and pass? &lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 12:05:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233631#M69411</guid>
      <dc:creator>mwdbhyat</dc:creator>
      <dc:date>2016-08-19T12:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233632#M69412</link>
      <description>&lt;P&gt;wrap that in a shell script and pass it one time. That way you do not have to type it every time. &lt;/P&gt;

&lt;P&gt;-auth admin:xxxx (Please remove it as soon as your backfill is complete).&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 12:14:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233632#M69412</guid>
      <dc:creator>Raghav2384</dc:creator>
      <dc:date>2016-08-19T12:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Automate backfill script</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233633#M69413</link>
      <description>&lt;P&gt;Cool, thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 12:18:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Automate-backfill-script/m-p/233633#M69413</guid>
      <dc:creator>mwdbhyat</dc:creator>
      <dc:date>2016-08-19T12:18:21Z</dc:date>
    </item>
  </channel>
</rss>

