<?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 Why my stats command return wrong  values ? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Why-my-stats-command-return-wrong-values/m-p/526915#M88871</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a search very simple but it returns wrong results :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1603900821689.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11544i77EC2CF0F6099594/image-size/large?v=v2&amp;amp;px=999" role="button" title="mah_0-1603900821689.png" alt="mah_0-1603900821689.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The problem is the result is&amp;nbsp;incoherent because the number of event is :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_2-1603901067229.png" style="width: 323px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11546iE19773D7764082ED/image-dimensions/323x152?v=v2" width="323" height="152" role="button" title="mah_2-1603901067229.png" alt="mah_2-1603901067229.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Total of OK and KO not exceed 100&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_3-1603901102927.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11547iD66328C61CF0B60A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_3-1603901102927.png" alt="mah_3-1603901102927.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can you help me please ?&lt;/P&gt;</description>
    <pubDate>Wed, 28 Oct 2020 16:07:52 GMT</pubDate>
    <dc:creator>mah</dc:creator>
    <dc:date>2020-10-28T16:07:52Z</dc:date>
    <item>
      <title>Why my stats command return wrong  values ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-my-stats-command-return-wrong-values/m-p/526915#M88871</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a search very simple but it returns wrong results :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1603900821689.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11544i77EC2CF0F6099594/image-size/large?v=v2&amp;amp;px=999" role="button" title="mah_0-1603900821689.png" alt="mah_0-1603900821689.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The problem is the result is&amp;nbsp;incoherent because the number of event is :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_2-1603901067229.png" style="width: 323px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11546iE19773D7764082ED/image-dimensions/323x152?v=v2" width="323" height="152" role="button" title="mah_2-1603901067229.png" alt="mah_2-1603901067229.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Total of OK and KO not exceed 100&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_3-1603901102927.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11547iD66328C61CF0B60A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_3-1603901102927.png" alt="mah_3-1603901102927.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can you help me please ?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 16:07:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-my-stats-command-return-wrong-values/m-p/526915#M88871</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-28T16:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why my stats command return wrong  values ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-my-stats-command-return-wrong-values/m-p/526917#M88872</link>
      <description>&lt;P&gt;Try doing this:&lt;/P&gt;&lt;P&gt;eval OK=if(like(State,"OK"),1,0), KO=if(like(State,"KO"),1,0)| stats sum(OK) sum(KO)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if that work.&lt;/P&gt;&lt;P&gt;-Marco&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 16:29:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-my-stats-command-return-wrong-values/m-p/526917#M88872</guid>
      <dc:creator>Marco</dc:creator>
      <dc:date>2020-10-28T16:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Why my stats command return wrong  values ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-my-stats-command-return-wrong-values/m-p/526920#M88873</link>
      <description>&lt;P&gt;Does State exist multiple times in any of the events so that when it is extracted you end up with a multi-value field such that 77% have OK in one of the values in the State field and 56% have KO in one of the values in the State field? Also, where you are counting State==OK and State==KO, perhaps this is counting where these are the only values of State in these events, i.e. the difference represents the number of events that have both values (OK and KO) in the multi-value field State?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 16:37:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-my-stats-command-return-wrong-values/m-p/526920#M88873</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-28T16:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why my stats command return wrong  values ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-my-stats-command-return-wrong-values/m-p/526935#M88876</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/224853"&gt;@Marco&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I change &lt;EM&gt;eval if&lt;/EM&gt; by &lt;EM&gt;eval case&lt;/EM&gt; in the search :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1603903808150.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11548iE68A93CD601F19A9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_0-1603903808150.png" alt="mah_0-1603903808150.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;it gives :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_3-1603904189896.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11551iBA1FA9A910414199/image-size/large?v=v2&amp;amp;px=999" role="button" title="mah_3-1603904189896.png" alt="mah_3-1603904189896.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_1-1603903889243.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11549i52788A6FA35CBD19/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_1-1603903889243.png" alt="mah_1-1603903889243.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;BUT my beginning query did the job for counting OK and KO BUT not for total. The result&amp;nbsp; is nonsense:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1603904979968.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11553i5D835C9653FA2EF0/image-size/large?v=v2&amp;amp;px=999" role="button" title="mah_0-1603904979968.png" alt="mah_0-1603904979968.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And more&amp;nbsp;amazing, when I want to add fields after the &lt;STRONG&gt;by&amp;nbsp;&lt;/STRONG&gt;the count increase :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_1-1603905188643.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11554i61A8BAD81132012F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_1-1603905188643.png" alt="mah_1-1603905188643.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;more fields after the &lt;STRONG&gt;by&lt;/STRONG&gt; I add, more the count increase !&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;State is a unique field in one event and containing 2 values : OK and KO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 17:19:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-my-stats-command-return-wrong-values/m-p/526935#M88876</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-28T17:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Why my stats command return wrong  values ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-my-stats-command-return-wrong-values/m-p/527095#M88905</link>
      <description>&lt;P&gt;Yes, It is as I said : all values in all fields was twice.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I added on the search head an app with the sourcetype "B" with le parameter&amp;nbsp;KV_MODE = none :&lt;/P&gt;&lt;P&gt;[B]&lt;/P&gt;&lt;P&gt;KV_MODE = none&lt;/P&gt;&lt;P&gt;and all values appear one time only :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_2-1603979247091.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11581i469CE570C2612CD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_2-1603979247091.png" alt="mah_2-1603979247091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And finally my beginning query works well !&lt;/P&gt;&lt;P&gt;Thank you for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 13:47:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-my-stats-command-return-wrong-values/m-p/527095#M88905</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-29T13:47:34Z</dc:date>
    </item>
  </channel>
</rss>

