<?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 Is there a way to add results to dbquery search when none are returned? Similar to 'fillnull' but for 'no results'. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-add-results-to-dbquery-search-when-none-are/m-p/231093#M188370</link>
    <description>&lt;P&gt;I am using DBquery to access a DB that has our monitoring configuration. I am trying to determine ratio of monitors meeting a certain monitor naming standard. I am doing this by parsing the monitor name and searching for and counting those meeting those standards, and then counting the total number of monitors. Most business groups have a least a couple monitors meeting the standard, but a few do not. This results in the standards search for those groups returning no results. What I want, is for it to return the number 0 so that I can calculate a coverage percentage with eval.&lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;P&gt;Biz group A has 100 monitors and 10 match standard = 10% coverage&lt;BR /&gt;
Biz group B has 200 monitors and NONE match standards. Therefore I cannot calculate the ratio.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Mar 2016 14:02:10 GMT</pubDate>
    <dc:creator>ericrobinson</dc:creator>
    <dc:date>2016-03-03T14:02:10Z</dc:date>
    <item>
      <title>Is there a way to add results to dbquery search when none are returned? Similar to 'fillnull' but for 'no results'.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-add-results-to-dbquery-search-when-none-are/m-p/231093#M188370</link>
      <description>&lt;P&gt;I am using DBquery to access a DB that has our monitoring configuration. I am trying to determine ratio of monitors meeting a certain monitor naming standard. I am doing this by parsing the monitor name and searching for and counting those meeting those standards, and then counting the total number of monitors. Most business groups have a least a couple monitors meeting the standard, but a few do not. This results in the standards search for those groups returning no results. What I want, is for it to return the number 0 so that I can calculate a coverage percentage with eval.&lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;P&gt;Biz group A has 100 monitors and 10 match standard = 10% coverage&lt;BR /&gt;
Biz group B has 200 monitors and NONE match standards. Therefore I cannot calculate the ratio.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 14:02:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-add-results-to-dbquery-search-when-none-are/m-p/231093#M188370</guid>
      <dc:creator>ericrobinson</dc:creator>
      <dc:date>2016-03-03T14:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to add results to dbquery search when none are returned? Similar to 'fillnull' but for 'no results'.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-add-results-to-dbquery-search-when-none-are/m-p/231094#M188371</link>
      <description>&lt;P&gt;show us your search.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 16:09:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-add-results-to-dbquery-search-when-none-are/m-p/231094#M188371</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-03-03T16:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to add results to dbquery search when none are returned? Similar to 'fillnull' but for 'no results'.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-add-results-to-dbquery-search-when-none-are/m-p/231095#M188372</link>
      <description>&lt;P&gt;| dbquery DB limit=10000 "select  * from Monitors  where NOTIFY_GROUP like '%fimt-aps-aat%'"  |search  DISABLED!=Yes  | search NOTIFY_GROUP!=support-group| where like(OBJECT_NAME, "%[AP%") | rex field=OBJECT_NAME "[(?AP\d+)]"  |stats count by NOTIFY_GROUP  | fillnull value=0 count| rename count AS app_id_count    | appendcols [dbquery DB limit=10000 "select  * from Monitors  where NOTIFY_GROUP like '%support-group%'"  |search  DISABLED!=Yes  | stats count by NOTIFY_GROUP | rename count AS monitor_count] | eval app_id_coverage_perc=round((app_id_count/monitor_count),2)*100| eval app_id_coverage=app_id_coverage_perc."%" |  table app_id_count, monitor_count, app_id_coverage&lt;/P&gt;

&lt;P&gt;The problem is that the first search returns no results for come of the support groups. I want to remove the no result and have it report as "0".&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:58:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-add-results-to-dbquery-search-when-none-are/m-p/231095#M188372</guid>
      <dc:creator>ericrobinson</dc:creator>
      <dc:date>2020-09-29T08:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to add results to dbquery search when none are returned? Similar to 'fillnull' but for 'no results'.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-add-results-to-dbquery-search-when-none-are/m-p/231096#M188373</link>
      <description>&lt;P&gt;I think that one of these 2 approaches should work:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/293823/how-to-table-list-of-values-from-lookup-not-found.html"&gt;https://answers.splunk.com/answers/293823/how-to-table-list-of-values-from-lookup-not-found.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/321170/fill-in-0-if-no-result-is-returned.html"&gt;https://answers.splunk.com/answers/321170/fill-in-0-if-no-result-is-returned.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 17:33:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-add-results-to-dbquery-search-when-none-are/m-p/231096#M188373</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-03-03T17:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to add results to dbquery search when none are returned? Similar to 'fillnull' but for 'no results'.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-add-results-to-dbquery-search-when-none-are/m-p/231097#M188374</link>
      <description>&lt;P&gt;Random performance questions: &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;You might be able to speed up your search by doing a &lt;CODE&gt;DBQUERY&lt;/CODE&gt; that looks for either types of &lt;CODE&gt;NOTIFY_GROUP&lt;/CODE&gt; and then use evals in the stats to count the individual items (like, &lt;CODE&gt;stats count(eval(NOTIFY_GROUP=="*support-group*")) AS sg_count&lt;/CODE&gt;)&lt;/LI&gt;
&lt;LI&gt;You can probably collapse some of the &lt;CODE&gt;search&lt;/CODE&gt; and &lt;CODE&gt;where&lt;/CODE&gt; commands into one: &lt;CODE&gt;| search DISABLED!=Yes NOTIFY_GROUP!=support-group OBJECT_NAME="*[AP*"&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;rex&lt;/CODE&gt; is used but there is no capture group. Perhaps something was removed for posting in answers. If not, it'll save some cycles to remove that line since it doesn't do anything&lt;/LI&gt;
&lt;LI&gt; Since only a few fields are used in the table at the end, you can probably collapse some of the final &lt;CODE&gt;eval&lt;/CODE&gt;s into one: &lt;CODE&gt;| eval app_id_coverage=round((app_id_count/monitor_count),2)*100."%"&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I realize you probably butchered the search to be able to post it so some of my questions might be derived from those changes.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 17:58:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-add-results-to-dbquery-search-when-none-are/m-p/231097#M188374</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2016-03-07T17:58:11Z</dc:date>
    </item>
  </channel>
</rss>

