<?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 set missing data values to zero? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171517#M49158</link>
    <description>&lt;P&gt;Hi, once i get the stats table, if i drill down, i am not getting intended results. i have tried drill down on row and cell. i guess this is the limitation of how it adds the row at the end of the query and when i drill down 2nd time it loses the context. any suggestions?&lt;/P&gt;</description>
    <pubDate>Wed, 13 Aug 2014 02:54:37 GMT</pubDate>
    <dc:creator>xvxt006</dc:creator>
    <dc:date>2014-08-13T02:54:37Z</dc:date>
    <item>
      <title>How to set missing data values to zero?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171512#M49153</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I want to track good requests (http=200) vs bad requests (http&amp;gt;399)and i have used the below query. But sometimes requests don't have bad requests then the column value is empty. So my formula is not working as it cannot copy empty value. So I am not getting an percentages. is this the right way to do this? i want track good and bad requests by uri as shown below. &lt;/P&gt;

&lt;P&gt;status=200  | rex field=uri_path "/(?&lt;URI_PATH&gt;(?:[^/]&lt;EM&gt;))" | stats count as GoodRequests, dc(sid) as GoodSessions by uri_path  | join type=outer uri_path   [search  status&amp;gt;399 | rex field=uri_path "/(?&lt;URI_PATH&gt;(?:[^/]&lt;/URI_PATH&gt;&lt;/EM&gt;))" | stats count as Failures, dc(sid) as FailedSessions by uri_path]|      eval TotalRequests= (GoodRequests+Failures)| eval TotalSessions=(GoodSessions+FailedSessions) | eval GoodRequestsPerc = round((GoodRequests/TotalRequests)*100,2) | eval GoodSessionsPerc = round((GoodSessions /TotalSessions)*100,2) | eval FailuresPerc = round((Failures/TotalRequests)*100,2) | eval FailureSessionsPerc = round((FailedSessions/TotalSessions)*100,2) | sort - Failures&lt;/URI_PATH&gt;&lt;/P&gt;

&lt;P&gt;In this below example  you can see only failures has data. &lt;/P&gt;

&lt;P&gt;uri_path    GoodRequests    GoodSessions    FailedSessions  FailureSessionsPerc Failures    FailuresPerc    GoodRequestsPerc    GoodSessionsPerc    TotalRequests   TotalSessions&lt;BR /&gt;
rest            3       8                    &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:16:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171512#M49153</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2020-09-28T17:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to set missing data values to zero?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171513#M49154</link>
      <description>&lt;P&gt;Hi @xvxt006&lt;/P&gt;

&lt;P&gt;I'm very much a search command apprentice in training so not sure if this will be super helpful, but have you tried the fillnull command? &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/SearchReference/Fillnull"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.3/SearchReference/Fillnull&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Aug 2014 17:07:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171513#M49154</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2014-08-05T17:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to set missing data values to zero?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171514#M49155</link>
      <description>&lt;P&gt;You can use fillnull command before "| eval TotalRequests=" (after join) as @Patrick suggested.&lt;/P&gt;

&lt;P&gt;You can also try this alternative approach (no joins, should perform better as well).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;status=200 OR status&amp;gt;399  | rex field=uri_path "/(?&amp;lt;uri_path&amp;gt;(?:[^/]*))" | eval requestType=if(status=200,"Good","Bad") 
| chart count as requests dc(side) as sessions over uri_path by requestType 
| rename "requests: Good" as GoodRequests ,"requests: Bad" as Failures , "sessions: Good" as GoodSessions , "sessions: Bad" as FailedSessions  
| eval TotalRequests= (GoodRequests+Failures)| eval TotalSessions=(GoodSessions+FailedSessions) 
| eval GoodRequestsPerc = round((GoodRequests/TotalRequests)*100,2) | eval GoodSessionsPerc = round((GoodSessions /TotalSessions)*100,2) 
| eval FailuresPerc = round((Failures/TotalRequests)*100,2) | eval FailureSessionsPerc = round((FailedSessions/TotalSessions)*100,2) | sort - Failures
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Aug 2014 17:10:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171514#M49155</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-08-05T17:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to set missing data values to zero?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171515#M49156</link>
      <description>&lt;P&gt;Thanks. This is more efficient.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Aug 2014 19:16:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171515#M49156</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2014-08-05T19:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to set missing data values to zero?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171516#M49157</link>
      <description>&lt;P&gt;I did not know about this. This is useful&lt;/P&gt;</description>
      <pubDate>Tue, 05 Aug 2014 19:17:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171516#M49157</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2014-08-05T19:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to set missing data values to zero?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171517#M49158</link>
      <description>&lt;P&gt;Hi, once i get the stats table, if i drill down, i am not getting intended results. i have tried drill down on row and cell. i guess this is the limitation of how it adds the row at the end of the query and when i drill down 2nd time it loses the context. any suggestions?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Aug 2014 02:54:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171517#M49158</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2014-08-13T02:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to set missing data values to zero?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171518#M49159</link>
      <description>&lt;P&gt;Actually i am able to see events in verbose mode. Let me know if there is any other way to view events.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Aug 2014 03:19:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-missing-data-values-to-zero/m-p/171518#M49159</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2014-08-13T03:19:19Z</dc:date>
    </item>
  </channel>
</rss>

