<?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: Why is my fillnull search with a BY clause not returning any results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220750#M64862</link>
    <description>&lt;P&gt;and the final result&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup channel2.csv| eval count=0, Channel=lower(Channel)| append [ search index=java host=*myhost* "PLACEORDER_API_UNSUCCESSFUL" orderSourceId=7 OR orderSourceId=6 OR orderSourceId=5 | eval Channel=lower(Channel) | stats count AS Failure BY Channel] |stats sum(count) AS Failure BY Channel | appendcols [search index=java host=*myhost* "PLACEORDER_API_SUCCESSFUL" orderSourceId=7 OR orderSourceId=6 OR orderSourceId=5 | eval Channel=case(orderSourceId == 7, "Desktop", orderSourceId == 6, "Andriod", orderSourceId == 5, "iOS") |stats count as Success by Channel]| appendcols [search (index=java host=*myhost* "Request received for placeOrder") OR (index=java host=*myhost* "PLACEORDER_API_REQUEST" orderSourceId=*) | transaction cartId maxspan=5sec| eval Channel=case(orderSourceId == 7, "Desktop", orderSourceId == 6, "Andriod", orderSourceId == 5, "iOS") | stats count by Channel] | eval Success_Percentage=(Success/(Success+Failure))*100 | table Channel Success Failure Success_Percentage
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Had to update the lookup a bit to get it to return the description as the Channel name&lt;/P&gt;</description>
    <pubDate>Tue, 15 Nov 2016 16:55:02 GMT</pubDate>
    <dc:creator>tkwaller</dc:creator>
    <dc:date>2016-11-15T16:55:02Z</dc:date>
    <item>
      <title>Why is my fillnull search with a BY clause not returning any results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220743#M64855</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;Trying to get this search to work, it works if I remove the BY clause:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=java host=*myhost* "PLACEORDER_API_UNSUCCESSFUL" orderSourceId=7 OR orderSourceId=6 OR orderSourceId=5 | eval Channel=case(orderSourceId == 7, "Desktop", orderSourceId == 6, "Andriod", orderSourceId == 5, "iOS") | stats count AS Failure BY Channel
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The issue is that the base search does not return any results.&lt;/P&gt;

&lt;P&gt;I tried &lt;CODE&gt;| fillnull value=NULL&lt;/CODE&gt; but it doesn't seem to work because of the BY clause. If I remove it, it works fine. &lt;/P&gt;

&lt;P&gt;Any ideas?&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 14:59:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220743#M64855</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-11-15T14:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my fillnull search with a BY clause not returning any results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220744#M64856</link>
      <description>&lt;P&gt;Hi tkwaller,&lt;BR /&gt;
If your search runs when you remove the BY clause means that, in your events, you haven't the "Channel" field with values.&lt;BR /&gt;
Verify if the field name is correct and in how many events is present.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 15:05:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220744#M64856</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-11-15T15:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my fillnull search with a BY clause not returning any results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220745#M64857</link>
      <description>&lt;P&gt;No meaning if I remove the BY clause and run it with the fillnull command at the end it works fine:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=java host=*myhost* "PLACEORDER_API_UNSUCCESSFUL" orderSourceId=7 OR orderSourceId=6 OR orderSourceId=5 | eval Channel=case(orderSourceId == 7, "Desktop", orderSourceId == 6, "Andriod", orderSourceId == 5, "iOS") | stats count AS Failure | fillnull value=NULL`
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Nov 2016 15:07:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220745#M64857</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-11-15T15:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my fillnull search with a BY clause not returning any results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220746#M64858</link>
      <description>&lt;P&gt;Hi tkwaller,&lt;BR /&gt;
Sorry but I didn't understand your need: &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;you have results running a stats count with BY clause,&lt;/LI&gt;
&lt;LI&gt;why you add the fillnull command? after a stats command you haven't any null results!&lt;/LI&gt;
&lt;LI&gt;"fillnull" replaces null values with a specified value;&lt;/LI&gt;
&lt;LI&gt;do you want to have the Channel values also without events? &lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;if you need is to have all results for all the Channel values (both with or without events) you have to create a lookup table with all your Channels and run something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | inputlookup Channels.csv | eval count=0, Channel=lower(Channel) | append [ search yoursearch | eval Channel=lower(Channel) | stats count by Channel ] | stats sum(count) AS Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way you have all the results for Channels, both with or without events.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 15:22:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220746#M64858</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-11-15T15:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my fillnull search with a BY clause not returning any results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220747#M64859</link>
      <description>&lt;P&gt;There are two ways you could do it.&lt;/P&gt;

&lt;P&gt;Option 1&lt;BR /&gt;
Using your case statements you need to add double quotes for values 5, 6 and 7 on right side of evaluation expression.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=java host=*myhost* "PLACEORDER_API_UNSUCCESSFUL" orderSourceId=7 OR orderSourceId=6 OR orderSourceId=5 | eval Channel=case(orderSourceId == "7", "Desktop", orderSourceId == "6", "Andriod", orderSourceId == "5", "iOS") | stats count AS Failure BY Channel
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Option 2&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=java host=*myhost* "PLACEORDER_API_UNSUCCESSFUL" orderSourceId=7 OR orderSourceId=6 OR orderSourceId=5 | eval Channel=orderSourceId | replace "7" with "Desktop" in Channel|replace "6" with "Android" in Channel| replace "5" with "iOS" in Channel| stats count AS Failure BY Channel
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Instead of eval Channel=orderSourceID
you can also use rename orderSourceId
as Channel.&lt;/LI&gt;
&lt;LI&gt;While Using replace
command numbers 5, 6 and 7 need not
be in double quotes, but safety does
not harm &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Tue, 15 Nov 2016 15:24:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220747#M64859</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-11-15T15:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my fillnull search with a BY clause not returning any results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220748#M64860</link>
      <description>&lt;P&gt;Yes the lookup table worked. Thank you.&lt;/P&gt;

&lt;P&gt;Here is the reason I ask. I am trying to combine that search along with some other stuff to create a dashboard with. I got it working, just evaluating it now:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup channel.csv| eval count=0, Channel=lower(Channel)| append [ search index=java host=*myhost* "PLACEORDER_API_UNSUCCESSFUL" orderSourceId=7 OR orderSourceId=6 OR orderSourceId=5 | eval Channel=lower(Channel) | stats count AS Failure BY Channel]| stats sum(count) AS Failure BY Channel | appendcols [search index=java host=*myhost* "PLACEORDER_API_SUCCESSFUL"  orderSourceId=7 OR orderSourceId=6 OR orderSourceId=5 | eval Channel=case(orderSourceId == 7, "Desktop", orderSourceId == 6, "Andriod", orderSourceId == 5, "iOS") |stats count as Success by Channel]| appendcols [search (index=java host=*myhost* "Request received for placeOrder")  OR (index=java host=*myhost* "PLACEORDER_API_REQUEST" orderSourceId=*) 
| transaction cartId maxspan=5sec| eval Channel=case(orderSourceId == 7, "Desktop", orderSourceId == 6, "Andriod", orderSourceId == 5, "iOS") | stats count by Channel] | eval Success_Percentage=(Success/(Success+Failure))*100 | table Channel Success Failure Success_Percentage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Nov 2016 16:17:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220748#M64860</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-11-15T16:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my fillnull search with a BY clause not returning any results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220749#M64861</link>
      <description>&lt;P&gt;the only thing I haven't figured out yet is how to get the description/Channel names included in the table.&lt;/P&gt;

&lt;P&gt;In the channel.csv I have a field called description that names the channels:&lt;BR /&gt;
"Desktop", "Andriod", "iOS"&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 16:53:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220749#M64861</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-11-15T16:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my fillnull search with a BY clause not returning any results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220750#M64862</link>
      <description>&lt;P&gt;and the final result&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup channel2.csv| eval count=0, Channel=lower(Channel)| append [ search index=java host=*myhost* "PLACEORDER_API_UNSUCCESSFUL" orderSourceId=7 OR orderSourceId=6 OR orderSourceId=5 | eval Channel=lower(Channel) | stats count AS Failure BY Channel] |stats sum(count) AS Failure BY Channel | appendcols [search index=java host=*myhost* "PLACEORDER_API_SUCCESSFUL" orderSourceId=7 OR orderSourceId=6 OR orderSourceId=5 | eval Channel=case(orderSourceId == 7, "Desktop", orderSourceId == 6, "Andriod", orderSourceId == 5, "iOS") |stats count as Success by Channel]| appendcols [search (index=java host=*myhost* "Request received for placeOrder") OR (index=java host=*myhost* "PLACEORDER_API_REQUEST" orderSourceId=*) | transaction cartId maxspan=5sec| eval Channel=case(orderSourceId == 7, "Desktop", orderSourceId == 6, "Andriod", orderSourceId == 5, "iOS") | stats count by Channel] | eval Success_Percentage=(Success/(Success+Failure))*100 | table Channel Success Failure Success_Percentage
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Had to update the lookup a bit to get it to return the description as the Channel name&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 16:55:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-fillnull-search-with-a-BY-clause-not-returning-any/m-p/220750#M64862</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-11-15T16:55:02Z</dc:date>
    </item>
  </channel>
</rss>

