<?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 What am I doing wrong in either my stats, append or eval because I keep getting a blank field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-am-I-doing-wrong-in-either-my-stats-append-or-eval-because/m-p/82465#M20942</link>
    <description>&lt;P&gt;I am very new to Splunk (as in this is my 3rd day using it) and am having some issues understanding what I am doing wrong.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; specific.server
    | stats dc(userID) as totalUsers
    | append [search specific.server AND "text" | stats count(field) as variableA]
    | eval variableB = exact(variableA/totalUsers)
    | stats sum(totalUsers), sum(variableA), sum(variableB)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now when this runs sum(totalUsers) and sum(variableA) shows up correctly however sum(variableB) always shows up as a blank field. I have tried many different ways and none of them have worked.&lt;/P&gt;

&lt;P&gt;Now I will explain the way I am understanding what I wrote. &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;First I am counting the number of individual users on a specific server and putting that number as a variable named
totalUsers.&lt;/LI&gt;
&lt;LI&gt;I am doing another search and in that search I count how many times a certain field occurs on that specific server and place that value into variableA&lt;/LI&gt;
&lt;LI&gt;I then create a new variable called variableB and evaluate that to be variableA/totalUsers&lt;/LI&gt;
&lt;LI&gt;This then is displayed with the sum of each individual variables totalUsers, variableA, variableB&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Please explain to me what I am understanding incorrectly and if at all possible how to achieve what I am trying to do or at least point me in the right direction.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 09 Jan 2013 18:11:57 GMT</pubDate>
    <dc:creator>brood85</dc:creator>
    <dc:date>2013-01-09T18:11:57Z</dc:date>
    <item>
      <title>What am I doing wrong in either my stats, append or eval because I keep getting a blank field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-am-I-doing-wrong-in-either-my-stats-append-or-eval-because/m-p/82465#M20942</link>
      <description>&lt;P&gt;I am very new to Splunk (as in this is my 3rd day using it) and am having some issues understanding what I am doing wrong.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; specific.server
    | stats dc(userID) as totalUsers
    | append [search specific.server AND "text" | stats count(field) as variableA]
    | eval variableB = exact(variableA/totalUsers)
    | stats sum(totalUsers), sum(variableA), sum(variableB)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now when this runs sum(totalUsers) and sum(variableA) shows up correctly however sum(variableB) always shows up as a blank field. I have tried many different ways and none of them have worked.&lt;/P&gt;

&lt;P&gt;Now I will explain the way I am understanding what I wrote. &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;First I am counting the number of individual users on a specific server and putting that number as a variable named
totalUsers.&lt;/LI&gt;
&lt;LI&gt;I am doing another search and in that search I count how many times a certain field occurs on that specific server and place that value into variableA&lt;/LI&gt;
&lt;LI&gt;I then create a new variable called variableB and evaluate that to be variableA/totalUsers&lt;/LI&gt;
&lt;LI&gt;This then is displayed with the sum of each individual variables totalUsers, variableA, variableB&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Please explain to me what I am understanding incorrectly and if at all possible how to achieve what I am trying to do or at least point me in the right direction.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2013 18:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-am-I-doing-wrong-in-either-my-stats-append-or-eval-because/m-p/82465#M20942</guid>
      <dc:creator>brood85</dc:creator>
      <dc:date>2013-01-09T18:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing wrong in either my stats, append or eval because I keep getting a blank field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-am-I-doing-wrong-in-either-my-stats-append-or-eval-because/m-p/82466#M20943</link>
      <description>&lt;P&gt;First, you don't want &lt;CODE&gt;append&lt;/CODE&gt;, you want &lt;CODE&gt;appendcols&lt;/CODE&gt;. When you use &lt;CODE&gt;append&lt;/CODE&gt;, you will end up with multiple events - you want all these results in a single event.&lt;BR /&gt;&lt;BR /&gt;
Second, you need to time-constrain your inner search, else it runs over all time. I have done that by using &lt;CODE&gt;addinfo&lt;/CODE&gt; to collect the time parameters of the outer search, and then apply them to the inner search.&lt;BR /&gt;&lt;BR /&gt;
Finally, I don't think you need the final stats command, either.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;specific.server
| stats dc(userID) as totalUsers
| appendcols [ search specific.server AND "text" 
      addinfo | where _time &amp;gt;= info_min_time AND _time &amp;lt;=info_max_time
      | stats count(field) as variableA ]
| eval variableB = exact(variableA/totalUsers)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Jan 2013 07:26:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-am-I-doing-wrong-in-either-my-stats-append-or-eval-because/m-p/82466#M20943</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-01-11T07:26:03Z</dc:date>
    </item>
  </channel>
</rss>

