<?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 make use of makeresults statement based on conditions ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-use-of-makeresults-statement-based-on-conditions/m-p/385451#M173085</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;index=app_core sourcetype=app_log apple_cluster_name=APP_TEST is_scheduled=1 eai_acl_owner=* 
| eval 
    [ search index= app_core sourcetype= app_log apple_cluster_name= APP_TEST is_scheduled=1 eai_acl_owner=* 
    | eval 
        [ search index= app_core sourcetype= app_log is_scheduled=1 apple_cluster_name= APP_TEST eai_acl_owner=* 
        | rex max_match=0 field=search "savedsearch\s{0,}\"{1}(?&amp;lt;anotherSavedSearchUseInSearch&amp;gt;(\w+){0,})" 
        | stats count values(dataStatus) as dataStatus dc(anotherSavedSearchUseInSearch) as rexCount 
        | eval dataStatus = if(count == 0 ,"dataDoesntExist","dataExists") 
        | eval dataStatusAndRexStatus = dataStatus.",".rexCount 
        | return dataStatusAndRexStatus ] 
    | eval dataStatus = mvindex(split(dataStatusAndRexStatus,","),0) 
    | eval rexCount = mvindex(split(dataStatusAndRexStatus,","),1) 
    | rex max_match=0 field=search "savedsearch\s{0,}\"{1}(?&amp;lt;anotherSavedSearchUseInSearch&amp;gt;(\w+){0,})" 
    | eval anotherSavedSearchUseInSearch = case(dataStatus == "dataDoesntExist","NoTitle2", rexCount == 0,"NoTitle2",rexCount &amp;gt; 0,anotherSavedSearchUseInSearch) 
    | stats values(anotherSavedSearchUseInSearch) as Title2 delim=" " 
    | nomv Title2 
    | return Title2]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From subsearch ——&amp;gt; Title2 is returning some value.&lt;/P&gt;

&lt;P&gt;But mainsearch (index=app_core sourcetype=app_log apple_cluster_name=APP_TEST is_scheduled=1 eai_acl_owner=* ) —&amp;gt; This is common , &lt;BR /&gt;
1. doesnt have any data in it , then it is showing error : Error in 'eval' command: Arguments are missing. Usage: eval dest_key = expression.&lt;BR /&gt;
2.  if data exists , then it doesnt thrown any error. &lt;/P&gt;

&lt;P&gt;The query should also work when data doesnt exists.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:15:31 GMT</pubDate>
    <dc:creator>nomadichunters</dc:creator>
    <dc:date>2020-09-29T23:15:31Z</dc:date>
    <item>
      <title>How to make use of makeresults statement based on conditions ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-use-of-makeresults-statement-based-on-conditions/m-p/385449#M173083</link>
      <description>&lt;P&gt;If in case there are no results then dummy data should be added and returned from the subsearch ortherwise the actual data should be retruned to eval condition?&lt;/P&gt;

&lt;P&gt;i.e How to make use of makeresults statement based on conditions ?&lt;/P&gt;

&lt;P&gt;Kindly help&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 10:22:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-use-of-makeresults-statement-based-on-conditions/m-p/385449#M173083</guid>
      <dc:creator>nomadichunters</dc:creator>
      <dc:date>2019-02-12T10:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to make use of makeresults statement based on conditions ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-use-of-makeresults-statement-based-on-conditions/m-p/385450#M173084</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Do you really need to use &lt;CODE&gt;makeresults&lt;/CODE&gt; ?&lt;/P&gt;

&lt;P&gt;You can try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval B_field=""
| append [ makeresults | eval B_field="Test"]
| eval result=if(isnull(B_field) OR B_field="","Dummy_Data",B_field)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Feb 2019 13:31:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-use-of-makeresults-statement-based-on-conditions/m-p/385450#M173084</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-02-12T13:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to make use of makeresults statement based on conditions ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-use-of-makeresults-statement-based-on-conditions/m-p/385451#M173085</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=app_core sourcetype=app_log apple_cluster_name=APP_TEST is_scheduled=1 eai_acl_owner=* 
| eval 
    [ search index= app_core sourcetype= app_log apple_cluster_name= APP_TEST is_scheduled=1 eai_acl_owner=* 
    | eval 
        [ search index= app_core sourcetype= app_log is_scheduled=1 apple_cluster_name= APP_TEST eai_acl_owner=* 
        | rex max_match=0 field=search "savedsearch\s{0,}\"{1}(?&amp;lt;anotherSavedSearchUseInSearch&amp;gt;(\w+){0,})" 
        | stats count values(dataStatus) as dataStatus dc(anotherSavedSearchUseInSearch) as rexCount 
        | eval dataStatus = if(count == 0 ,"dataDoesntExist","dataExists") 
        | eval dataStatusAndRexStatus = dataStatus.",".rexCount 
        | return dataStatusAndRexStatus ] 
    | eval dataStatus = mvindex(split(dataStatusAndRexStatus,","),0) 
    | eval rexCount = mvindex(split(dataStatusAndRexStatus,","),1) 
    | rex max_match=0 field=search "savedsearch\s{0,}\"{1}(?&amp;lt;anotherSavedSearchUseInSearch&amp;gt;(\w+){0,})" 
    | eval anotherSavedSearchUseInSearch = case(dataStatus == "dataDoesntExist","NoTitle2", rexCount == 0,"NoTitle2",rexCount &amp;gt; 0,anotherSavedSearchUseInSearch) 
    | stats values(anotherSavedSearchUseInSearch) as Title2 delim=" " 
    | nomv Title2 
    | return Title2]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From subsearch ——&amp;gt; Title2 is returning some value.&lt;/P&gt;

&lt;P&gt;But mainsearch (index=app_core sourcetype=app_log apple_cluster_name=APP_TEST is_scheduled=1 eai_acl_owner=* ) —&amp;gt; This is common , &lt;BR /&gt;
1. doesnt have any data in it , then it is showing error : Error in 'eval' command: Arguments are missing. Usage: eval dest_key = expression.&lt;BR /&gt;
2.  if data exists , then it doesnt thrown any error. &lt;/P&gt;

&lt;P&gt;The query should also work when data doesnt exists.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:15:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-use-of-makeresults-statement-based-on-conditions/m-p/385451#M173085</guid>
      <dc:creator>nomadichunters</dc:creator>
      <dc:date>2020-09-29T23:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to make use of makeresults statement based on conditions ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-use-of-makeresults-statement-based-on-conditions/m-p/385452#M173086</link>
      <description>&lt;P&gt;As stated in the other question (&lt;A href="https://answers.splunk.com/answers/726353/subsearch-returns-empty-value-main-search-also-ret.html"&gt;https://answers.splunk.com/answers/726353/subsearch-returns-empty-value-main-search-also-ret.html&lt;/A&gt;) you can use a &lt;CODE&gt;eval Title2=coalesce(Title2,"")&lt;/CODE&gt; to ensure your subsearch returns a valid result. &lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 13:53:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-use-of-makeresults-statement-based-on-conditions/m-p/385452#M173086</guid>
      <dc:creator>DMohn</dc:creator>
      <dc:date>2019-02-12T13:53:58Z</dc:date>
    </item>
  </channel>
</rss>

