<?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 Show meesage if no results but continue applyng commands if there are results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Show-meesage-if-no-results-but-continue-applyng-commands-if/m-p/349545#M103471</link>
    <description>&lt;P&gt;I have a following query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main source=mylogsource.log "Response Message:*" "234998102" 
| ifnoresults ---&amp;gt; (eval message | show message), if there are results --&amp;gt; continue applying the next commands
| eval number = 234998102
| rex field=_raw "(?:&amp;lt;balance couponType=\"Customer\"&amp;gt;)(?P&amp;lt;customerCoupons&amp;gt;\d+)(?:&amp;lt;/balance&amp;gt;)" 
| rex field=_raw "(?:&amp;lt;balance couponType=\"Companion\"&amp;gt;)(?P&amp;lt;companionCoupons&amp;gt;\d+)(?:&amp;lt;/balance&amp;gt;)" 
| rex field=_raw "(?:&amp;lt;balance couponType=\"Both\"&amp;gt;)(?P&amp;lt;bothCoupons&amp;gt;\d+)(?:&amp;lt;/balance&amp;gt;)" 
| table number, trkid, customerCoupons, companionCoupons, bothCoupons
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My idea is show a message if the base search doesn't have results or continue with the commands pipe if there are results.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;It is possible achieve this?&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Apr 2017 13:43:17 GMT</pubDate>
    <dc:creator>gpincheiraa</dc:creator>
    <dc:date>2017-04-25T13:43:17Z</dc:date>
    <item>
      <title>Show meesage if no results but continue applyng commands if there are results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-meesage-if-no-results-but-continue-applyng-commands-if/m-p/349545#M103471</link>
      <description>&lt;P&gt;I have a following query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main source=mylogsource.log "Response Message:*" "234998102" 
| ifnoresults ---&amp;gt; (eval message | show message), if there are results --&amp;gt; continue applying the next commands
| eval number = 234998102
| rex field=_raw "(?:&amp;lt;balance couponType=\"Customer\"&amp;gt;)(?P&amp;lt;customerCoupons&amp;gt;\d+)(?:&amp;lt;/balance&amp;gt;)" 
| rex field=_raw "(?:&amp;lt;balance couponType=\"Companion\"&amp;gt;)(?P&amp;lt;companionCoupons&amp;gt;\d+)(?:&amp;lt;/balance&amp;gt;)" 
| rex field=_raw "(?:&amp;lt;balance couponType=\"Both\"&amp;gt;)(?P&amp;lt;bothCoupons&amp;gt;\d+)(?:&amp;lt;/balance&amp;gt;)" 
| table number, trkid, customerCoupons, companionCoupons, bothCoupons
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My idea is show a message if the base search doesn't have results or continue with the commands pipe if there are results.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;It is possible achieve this?&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 13:43:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-meesage-if-no-results-but-continue-applyng-commands-if/m-p/349545#M103471</guid>
      <dc:creator>gpincheiraa</dc:creator>
      <dc:date>2017-04-25T13:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: Show meesage if no results but continue applyng commands if there are results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-meesage-if-no-results-but-continue-applyng-commands-if/m-p/349546#M103472</link>
      <description>&lt;P&gt;I've never tried it in the middle of a search before, i've always tacked it onto the end if there were no results, but this is my method for that:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| appendpipe [ stats count | eval message="There is no data for this time period."  | where count==0 |table message]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if that works in the middle of your search or what happens if it doesn't.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 15:26:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-meesage-if-no-results-but-continue-applyng-commands-if/m-p/349546#M103472</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-04-25T15:26:05Z</dc:date>
    </item>
  </channel>
</rss>

