<?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 edit my scheduled outputlookup search to NOT overwrite the existing lookup table if the new results are blank? in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181405#M3931</link>
    <description>&lt;P&gt;makes sense, works fine.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jul 2015 10:28:16 GMT</pubDate>
    <dc:creator>dominiquevocat</dc:creator>
    <dc:date>2015-07-16T10:28:16Z</dc:date>
    <item>
      <title>How to edit my scheduled outputlookup search to NOT overwrite the existing lookup table if the new results are blank?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181401#M3927</link>
      <description>&lt;P&gt;I completely refresh my outputlookup everyday using the search below. I have scheduled this outputlookup as cron job.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = ind sourcetype= todaydata earliest = -1d@d latest = now | my search ...|table one two |outputlookup look.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But in case the data is blank for some reason in last one day, the search currently updates the table results to zero.&lt;/P&gt;

&lt;P&gt;I do not want to append the data. I want to refresh it everyday (deleting the previous one and inserting the new one), but I want to put in a condition while inserting that if the number of today's results is zero, DO NOT overwrite the already existing table.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 07:50:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181401#M3927</guid>
      <dc:creator>ishugupta</dc:creator>
      <dc:date>2015-03-20T07:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my scheduled outputlookup search to NOT overwrite the existing lookup table if the new results are blank?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181402#M3928</link>
      <description>&lt;P&gt;I am assuming if your base search (&lt;CODE&gt;index = ind sourcetype= todaydata earliest = -1d@d latest = now&lt;/CODE&gt;) is NOT showing any data, you want your lookup to remain same as yesterday's version and overwrite if there are any data available, then try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = ind sourcetype= todaydata earliest = -1d@d latest = now | head 1 | map search="search index = ind sourcetype= todaydata earliest = -1d@d latest = now | my search ...|table one two |outputlookup look.csv"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It will only execute the search mentioned in map command if earliest portion of the query returning 1 row and will skip the execution otherwise.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 19:44:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181402#M3928</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-03-20T19:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my scheduled outputlookup search to NOT overwrite the existing lookup table if the new results are blank?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181403#M3929</link>
      <description>&lt;P&gt;Thanks Somesoni , It is not working for me . The command within map search=" search  ..." is providing me zero results .&lt;BR /&gt;&lt;BR /&gt;
Whenver I table the results in the internal query , they provide me zero results.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 21:04:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181403#M3929</guid>
      <dc:creator>ishugupta</dc:creator>
      <dc:date>2015-03-20T21:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my scheduled outputlookup search to NOT overwrite the existing lookup table if the new results are blank?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181404#M3930</link>
      <description>&lt;P&gt;&lt;STRONG&gt;UPDATE: Splunk 7.1&lt;/STRONG&gt; has added a new outputlookup parameter "override_if_empty=". Set it to "false" to keep the lookup file if search results are empty. Note the default is 'true', the the behaviour is the same as before unless you tell it otherwise.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Pre-7.1 Method:&lt;/STRONG&gt; &lt;BR /&gt;
Here's an idea to try and deal with this issue:&lt;/P&gt;

&lt;P&gt;Get the new data and apply a simple identifying field ('new' in this example) then append the existing lookup data with a different identifying field ('old' in the below example)&lt;/P&gt;

&lt;P&gt;Use eventstats across all of the results to count the results for each identifying field. &lt;/P&gt;

&lt;P&gt;Finally use a where clause to drop the old data if new data exists or keep the old data if there are no new results. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search for new data&amp;gt;...  
| eval new=1  
| append [|inputlookup &amp;lt;lookup&amp;gt;  
| eval old=1]  
| eventstats count(old) as existing_count count(new) AS update_count  
| where (update_count&amp;gt;0 AND new=1) OR (isnull(update_count) AND old=1)  
| fields - update_count existing_count old new  
| outputlookup &amp;lt;lookup&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:43:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181404#M3930</guid>
      <dc:creator>mbenwell</dc:creator>
      <dc:date>2020-09-28T19:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my scheduled outputlookup search to NOT overwrite the existing lookup table if the new results are blank?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181405#M3931</link>
      <description>&lt;P&gt;makes sense, works fine.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2015 10:28:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181405#M3931</guid>
      <dc:creator>dominiquevocat</dc:creator>
      <dc:date>2015-07-16T10:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my scheduled outputlookup search to NOT overwrite the existing lookup table if the new results are blank?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181406#M3932</link>
      <description>&lt;P&gt;Hi @ishugupta&lt;/P&gt;

&lt;P&gt;Just wanted to follow up with this post, but did @mbenwell's answer below solve your question by chance?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2015 19:15:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181406#M3932</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2015-08-18T19:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my scheduled outputlookup search to NOT overwrite the existing lookup table if the new results are blank?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181407#M3933</link>
      <description>&lt;P&gt;Thanks mbenwell.  You have my vote.&lt;BR /&gt;
Your solution works well even in 2018 (as we still use Splunk 6.x). &lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 07:06:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181407#M3933</guid>
      <dc:creator>judevine</dc:creator>
      <dc:date>2018-07-05T07:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my scheduled outputlookup search to NOT overwrite the existing lookup table if the new results are blank?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181408#M3934</link>
      <description>&lt;P&gt;Thanks mbenwell.  You have my vote.&lt;BR /&gt;
Your solution works well even in 2018 (as we still use Splunk 6.x). &lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 07:06:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/181408#M3934</guid>
      <dc:creator>judevine</dc:creator>
      <dc:date>2018-07-05T07:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my scheduled outputlookup search to NOT overwrite the existing lookup table if the new results are blank</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/523565#M8493</link>
      <description>&lt;P&gt;i was searching for the similar issue and after reading this solution i assumed the current Splunk version also works similar to this solution. Then i was reading the docs and learnt the new options available, so i thought to update other readers who may face similar situation like myself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Until Splunk 6.5, the scheduled reports never had "Write to a CSV lookup file" option. Ref:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.0/Report/Schedulereports" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.0/Report/Schedulereports&lt;/A&gt;&lt;/P&gt;&lt;P&gt;From Splunk 6.6,&amp;nbsp;the scheduled reports are having a "Write to a CSV lookup file" option. Ref:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.6.0/Report/Schedulereports#Define_a_Write_to_a_CSV_Lookup_File_action" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/6.6.0/Report/Schedulereports#Define_a_Write_to_a_CSV_Lookup_File_action&lt;/A&gt;&lt;/P&gt;&lt;P&gt;so, if we are using Splunk 6.6 or newer versions, then, simply with scheduled reports, we can "append" the lookup files. thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(PS - i have given around 500+ karma points so far, received badge for that, if an answer helped you, a karma point would be nice!. we all should start "Learn, Give Back, Have Fun")&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 01:47:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-edit-my-scheduled-outputlookup-search-to-NOT-overwrite/m-p/523565#M8493</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-10-08T01:47:08Z</dc:date>
    </item>
  </channel>
</rss>

