<?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: Show 0% if no results are found in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518641#M145928</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I should have said that the search is usually "server_group=*", I am just using this group because it is the offending group that is giving me problems.&lt;/P&gt;&lt;P&gt;I don't really understand the point of creating a lookup for this, the search already returns the servers that are being monitored.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2020 10:07:26 GMT</pubDate>
    <dc:creator>FraserC1</dc:creator>
    <dc:date>2020-09-09T10:07:26Z</dc:date>
    <item>
      <title>Show 0% if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518632#M145922</link>
      <description>&lt;P&gt;I have the following search:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="automox" sourcetype="automox:devices" server_group="Windows Server Pilot"
| dedup name 
| top pending, server_group 
| fields - percent 
| eventstats sum(count) as total by server_group 
| eval percent=round(count*100/total,2) 
| fields - total
| where pending="false"
| sort -percent
| rename server_group AS "Server Group", count AS "Devices", percent AS "Patched Percent"
| table "Server Group", "Patched Percent"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do is when there are no events with "pending=false" , I would like this to be reflected in the stats table as 0%. This is for patch compliance which is why I would like this.&lt;/P&gt;&lt;P&gt;I tried using fillnull but I haven't managed to get it working.&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 09:17:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518632#M145922</guid>
      <dc:creator>FraserC1</dc:creator>
      <dc:date>2020-09-09T09:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Show 0% if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518636#M145924</link>
      <description>&lt;P&gt;Try adding this to your search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| appendpipe [stats count|where count==0|eval "Patched Percent"=0]&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 09 Sep 2020 09:36:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518636#M145924</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-09-09T09:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Show 0% if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518637#M145925</link>
      <description>&lt;LI-CODE lang="markup"&gt;| stats count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 09:38:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518637#M145925</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-09-09T09:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Show 0% if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518638#M145926</link>
      <description>&lt;P&gt;This is a common scenario - trying to find something that doesn't exist in your data. in your case, you could append some "dummy" events with count=0 possibly for all the event types, then add these to your existing events.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 09:38:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518638#M145926</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-09T09:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Show 0% if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518639#M145927</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/96704"&gt;@FraserC1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the problem is to know the list of servers to monitor.&lt;/P&gt;&lt;P&gt;The easiest way is to create a lookup (called e.g. perimeter.csv ) with this list (at least one field called server_group).&lt;/P&gt;&lt;P&gt;Lookup that you can update automatically with a scheduled search or manually.&lt;/P&gt;&lt;P&gt;Then you have to add some rows to your search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="automox" sourcetype="automox:devices" server_group="Windows Server Pilot"
| dedup name 
| top pending, server_group 
| fields - percent 
| eventstats sum(count) as total by server_group 
| eval percent=round(count*100/total,2) 
| fields - total
| where pending="false"
| eval server_group=lower(server_group)
| append [ | inputlookup perimeter.csv | eval server_group=lower(server_group), percent=0 | fields server_group percent ]
| stats sum(percent) AS percent BY server_group
| sort -percent
| rename server_group AS "Server Group", count AS "Devices", percent AS "Patched Percent"
| table "Server Group", "Patched Percent"&lt;/LI-CODE&gt;&lt;P&gt;Only one question: how can you have more server_groups if you filter your results in the main search with one server_group?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 09:53:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518639#M145927</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-09T09:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Show 0% if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518641#M145928</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I should have said that the search is usually "server_group=*", I am just using this group because it is the offending group that is giving me problems.&lt;/P&gt;&lt;P&gt;I don't really understand the point of creating a lookup for this, the search already returns the servers that are being monitored.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 10:07:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518641#M145928</guid>
      <dc:creator>FraserC1</dc:creator>
      <dc:date>2020-09-09T10:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Show 0% if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518642#M145929</link>
      <description>&lt;P&gt;Thanks, I think I get what you mean but not sure how to implement it. I will do some googling and see what I can find.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 10:07:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518642#M145929</guid>
      <dc:creator>FraserC1</dc:creator>
      <dc:date>2020-09-09T10:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Show 0% if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518643#M145930</link>
      <description>&lt;P&gt;Absolutely useless.&lt;/P&gt;&lt;P&gt;I am assuming you didn't even read the question.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 10:08:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518643#M145930</guid>
      <dc:creator>FraserC1</dc:creator>
      <dc:date>2020-09-09T10:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Show 0% if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518644#M145931</link>
      <description>&lt;P&gt;Thanks for this, I tried it but it doesn't give me what I want.&lt;/P&gt;&lt;P&gt;I think the problem is because no events are returned because of "pending=false"&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 10:10:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518644#M145931</guid>
      <dc:creator>FraserC1</dc:creator>
      <dc:date>2020-09-09T10:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Show 0% if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518652#M145933</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="automox" sourcetype="automox:devices" server_group="Windows Server Pilot"
| dedup name 
| top pending, server_group 
| appendpipe [ stats values(pending) as pending by server_group | eval count=0, percent=0, pending="false" ]
| stats sum(count) as count by pending, server_group
| eventstats sum(count) as total by server_group | eventstats sum(count) as total by server_group 
| eval percent=round(count*100/total,2) 
| fields - total
| where pending="false"
| sort -percent
| rename server_group AS "Server Group", count AS "Devices", percent AS "Patched Percent"
| table "Server Group", "Patched Percent"&lt;/LI-CODE&gt;&lt;P&gt;This should add a "dummy" event with pending="false" for every server_group with count of 0, then add the 0 to any existing pending="false" counts, before you calculate the total for the server_group (I removed the fields - percent because that should not get past the stats, in any event you are overriding it with the eval)&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 11:30:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518652#M145933</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-09T11:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Show 0% if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518671#M145940</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/96704"&gt;@FraserC1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if the search returns all the group_servers you haven't any problem and don't need any add-on to you search, you have all the resuolts.&lt;/P&gt;&lt;P&gt;My solution is to solve the situation when some group_server is missing (and I understood that this is your problem, if I'm wrong, sorry!), but to do this you have to know the exact list of group_servers to monitor.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 12:27:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-0-if-no-results-are-found/m-p/518671#M145940</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-09T12:27:03Z</dc:date>
    </item>
  </channel>
</rss>

