<?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 How to pass 0 to variable if no search result is found? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-0-to-variable-if-no-search-result-is-found/m-p/440704#M125271</link>
    <description>&lt;P&gt;I have  scenario where I want variable (Loss) to be 0 if no result found of below search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dbxquery query="SELECT * FROM \"Cherwell\".\"dbo\".\"v_ServicelineToLogicalDevice_Splunk\"" connection="Cherwell-DB" 
| rename LNCID as RecID 
| join type=inner RecID 
    [| dbxquery query="SELECT * FROM \"Cherwell\".\"dbo\".\"v_LogicalCircuits_Splunk\"" connection="Cherwell-DB"] 
| rename RecID as LNCID 
| fields - Bandwidth Status 
| rename LogicalObjectSiteAID as Rec_ID 
| join type=inner Rec_ID 
    [ inputlookup objects] 
| rename Device_Name as Hostname 
| join type=inner Hostname 
    [ search index=index_zabbixnotify 
    | dedup IP Alarm 
    | search Status="PROBLEM"] 
| rename ServiceLineID as RecID 
| join type=left RecID 
    [| dbxquery query="SELECT * FROM \"Cherwell\".\"dbo\".\"v_ServiceLines_Splunk\"" connection="Cherwell-DB"] 
| search Status=Active 
| stats sum(Bandwidth) as Loss
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want Loss to be filled with 0 if nothing found. Search is working fine if it find some events.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jun 2019 00:25:59 GMT</pubDate>
    <dc:creator>ahmadsaadwarrai</dc:creator>
    <dc:date>2019-06-25T00:25:59Z</dc:date>
    <item>
      <title>How to pass 0 to variable if no search result is found?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-0-to-variable-if-no-search-result-is-found/m-p/440704#M125271</link>
      <description>&lt;P&gt;I have  scenario where I want variable (Loss) to be 0 if no result found of below search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dbxquery query="SELECT * FROM \"Cherwell\".\"dbo\".\"v_ServicelineToLogicalDevice_Splunk\"" connection="Cherwell-DB" 
| rename LNCID as RecID 
| join type=inner RecID 
    [| dbxquery query="SELECT * FROM \"Cherwell\".\"dbo\".\"v_LogicalCircuits_Splunk\"" connection="Cherwell-DB"] 
| rename RecID as LNCID 
| fields - Bandwidth Status 
| rename LogicalObjectSiteAID as Rec_ID 
| join type=inner Rec_ID 
    [ inputlookup objects] 
| rename Device_Name as Hostname 
| join type=inner Hostname 
    [ search index=index_zabbixnotify 
    | dedup IP Alarm 
    | search Status="PROBLEM"] 
| rename ServiceLineID as RecID 
| join type=left RecID 
    [| dbxquery query="SELECT * FROM \"Cherwell\".\"dbo\".\"v_ServiceLines_Splunk\"" connection="Cherwell-DB"] 
| search Status=Active 
| stats sum(Bandwidth) as Loss
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want Loss to be filled with 0 if nothing found. Search is working fine if it find some events.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 00:25:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-0-to-variable-if-no-search-result-is-found/m-p/440704#M125271</guid>
      <dc:creator>ahmadsaadwarrai</dc:creator>
      <dc:date>2019-06-25T00:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass 0 to variable if no search result is found?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-0-to-variable-if-no-search-result-is-found/m-p/440705#M125272</link>
      <description>&lt;P&gt;You can add the following line at the end of your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| appendpipe [stats count | where count=0 | eval Loss=0 | fields - count]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jun 2019 02:33:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-0-to-variable-if-no-search-result-is-found/m-p/440705#M125272</guid>
      <dc:creator>denzelchung</dc:creator>
      <dc:date>2019-06-25T02:33:31Z</dc:date>
    </item>
  </channel>
</rss>

