<?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 Result of a calc in a timechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Result-of-a-calc-in-a-timechart/m-p/467824#M131689</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm trying to make an availability graph based on the below calculation:&lt;/P&gt;

&lt;P&gt;index="MY_INDEX" host="MY_HOST"  NOT "UNWANTED_VHOST" | stats count(eval(status="500" OR status="501" OR status="502" OR status="503" OR status="504" OR status="505" OR status="506" OR status="507" OR status="508" OR status="509" OR status="510" OR status="511")) as error count(eval(status="200")) as good   | head 100   | eval calc = (100/(good+error))*good | stats sum(calc) as Disponibilité&lt;/P&gt;

&lt;P&gt;The calculation is Ok but I'm not coming to create a timechart where the evolution of "Disponibilité" is calculated day by day.&lt;/P&gt;

&lt;P&gt;Do you have any idea of how I can do that ?&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 04:07:34 GMT</pubDate>
    <dc:creator>tmeriadec</dc:creator>
    <dc:date>2020-09-30T04:07:34Z</dc:date>
    <item>
      <title>Result of a calc in a timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Result-of-a-calc-in-a-timechart/m-p/467824#M131689</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm trying to make an availability graph based on the below calculation:&lt;/P&gt;

&lt;P&gt;index="MY_INDEX" host="MY_HOST"  NOT "UNWANTED_VHOST" | stats count(eval(status="500" OR status="501" OR status="502" OR status="503" OR status="504" OR status="505" OR status="506" OR status="507" OR status="508" OR status="509" OR status="510" OR status="511")) as error count(eval(status="200")) as good   | head 100   | eval calc = (100/(good+error))*good | stats sum(calc) as Disponibilité&lt;/P&gt;

&lt;P&gt;The calculation is Ok but I'm not coming to create a timechart where the evolution of "Disponibilité" is calculated day by day.&lt;/P&gt;

&lt;P&gt;Do you have any idea of how I can do that ?&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Result-of-a-calc-in-a-timechart/m-p/467824#M131689</guid>
      <dc:creator>tmeriadec</dc:creator>
      <dc:date>2020-09-30T04:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Result of a calc in a timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Result-of-a-calc-in-a-timechart/m-p/467825#M131690</link>
      <description>&lt;P&gt;@tmeriadec Try changing your last line to achieve what you're looking for. The &lt;CODE&gt;Timechart&lt;/CODE&gt; command is similar to &lt;CODE&gt;stats&lt;/CODE&gt;, but includes _time in its use automatically, whereas using &lt;CODE&gt;stats&lt;/CODE&gt; you would have to account for this on your own. The &lt;CODE&gt;span=1d&lt;/CODE&gt; is to set your time bucketing into 1 day bins.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart span=1d sum(calc) AS Disponibilité
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Feb 2020 14:49:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Result-of-a-calc-in-a-timechart/m-p/467825#M131690</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2020-02-17T14:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Result of a calc in a timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Result-of-a-calc-in-a-timechart/m-p/467826#M131691</link>
      <description>&lt;P&gt;I'm not exactly sure how you want to represent this data, maybe this is what you are looking for, but in any case its a simpler search.&lt;/P&gt;

&lt;P&gt;Try the following and let us know how you would like to represent it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="MY_INDEX" host="MY_HOST" NOT "UNWANTED_VHOST" 
| eval result=case(status&amp;gt;500, "error", status=200, "good",1=1,"unknown")
| timechart count by result
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Feb 2020 14:53:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Result-of-a-calc-in-a-timechart/m-p/467826#M131691</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-17T14:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Result of a calc in a timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Result-of-a-calc-in-a-timechart/m-p/467827#M131692</link>
      <description>&lt;P&gt;Thanks for your quick answers @efavreau, @nickhillscpl &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;With your help I've found the solution for my case and I put it below if it's can help somebody  :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="MY_INDEX" host="MY_HOST" NOT "UNWANTED_VHOST"  |  timechart span=1Month count(eval(status&amp;gt;500)) as error count(eval(status="200")) as good | head 100 | eval calc = (100/(good+error))*good | table _time calc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Have a nice day&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 16:20:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Result-of-a-calc-in-a-timechart/m-p/467827#M131692</guid>
      <dc:creator>tmeriadec</dc:creator>
      <dc:date>2020-02-17T16:20:14Z</dc:date>
    </item>
  </channel>
</rss>

