<?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: timechart percentage data - not working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43845#M10337</link>
    <description>&lt;P&gt;The timechart can't perform the eval math, my mistake.  As a quick fix to get you going, do the search as you originally had it, but add "by _time" to the end of your stats command.  That will produce the time values you need for the timechart.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Feb 2011 08:22:12 GMT</pubDate>
    <dc:creator>Ron_Naken</dc:creator>
    <dc:date>2011-02-15T08:22:12Z</dc:date>
    <item>
      <title>timechart percentage data - not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43838#M10330</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to plot the percentage data over a period of span 1h.&lt;/P&gt;

&lt;P&gt;host="abc" sourcetype="xyz" ("Eurl" ) | eval series1 =  "Request" | append [search host="abc" sourcetype="xyz" ("Esuccess") | eval series2 =  "Success"] | stats count(series1) as s1, count(series2) as s2 | eval pct=(s2*100/s1) | timechart span=1h avg(pct)&lt;/P&gt;

&lt;P&gt;I am able to see the PCT value in one row, which is not helping the cause. I am looking for PCT data for every 1 hour.&lt;/P&gt;

&lt;P&gt;This query does not return result if I add timechart. Not sure about the reason.&lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2011 15:36:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43838#M10330</guid>
      <dc:creator>aahadqj</dc:creator>
      <dc:date>2011-02-14T15:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: timechart percentage data - not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43839#M10331</link>
      <description>&lt;P&gt;Try it like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="abc" sourcetype="xyz" ("Eurl" ) | eval series1 = "Request" | append [search host="abc" sourcetype="xyz" ("Esuccess") | eval series2 = "Success"] | timechart span=1h count(series2)*100/count(series1)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Your &lt;STRONG&gt;stats&lt;/STRONG&gt; output doesn't contain the temporal values you need for the &lt;STRONG&gt;timechart&lt;/STRONG&gt;.  Easier than doing a "&lt;STRONG&gt;by _time&lt;/STRONG&gt;" in your &lt;STRONG&gt;stats&lt;/STRONG&gt;, you can just perform the math with &lt;STRONG&gt;timechart&lt;/STRONG&gt; -- it supports the same functions as &lt;STRONG&gt;stats&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2011 15:54:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43839#M10331</guid>
      <dc:creator>Ron_Naken</dc:creator>
      <dc:date>2011-02-14T15:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: timechart percentage data - not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43840#M10332</link>
      <description>&lt;P&gt;It's quite common to do complex things like this with &lt;CODE&gt;join&lt;/CODE&gt; and &lt;CODE&gt;append&lt;/CODE&gt;.   In the end it's easier to do with a disjunction (OR) and a little bit of eval magic.  Also by eliminating the subsearch you'll speed things up quite a bit.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;host="abc" sourcetype="xyz" (Eurl OR Esuccess) | eval series = if(searchmatch("eurl","Request",series)) | eval series = if(searchmatch("Esuccess","Success",series)) | timechart count by series | eval pct=Success*100/Request | fields - Success request&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Here we just take all the events glommed together from both "Eurl" and "Esuccess", and we use eval to paint a field called 'series' onto the events, which will have values "Request" and "Success".  Specifically the &lt;CODE&gt;if&lt;/CODE&gt; function in eval will evaluate the first argument, which is a &lt;CODE&gt;searchmatch&lt;/CODE&gt; function. If the &lt;CODE&gt;searchmatch&lt;/CODE&gt; matches, &lt;CODE&gt;if&lt;/CODE&gt; will return the second argument. Otherwise &lt;CODE&gt;if&lt;/CODE&gt; returns the third argument.
Then we let plain old timechart split this up by the two values.  And then a little eval on the end I think should give you the percent you want. &lt;/P&gt;

&lt;P&gt;minor notes:  your &lt;CODE&gt;stats count&lt;/CODE&gt; was essentially throwing away all your time information.  Delete the timechart clause in your original searhc and run it again,  then picture giving those output rows to timechart, as though those two rows were the only events.  You'll then understand why timechart was doing what it was doing. &lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2011 15:55:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43840#M10332</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-02-14T15:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: timechart percentage data - not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43841#M10333</link>
      <description>&lt;P&gt;The expression - count(series2)*100/count(series1) is not returning any result in the splunk. Do you know what could be the reason?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2011 18:29:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43841#M10333</guid>
      <dc:creator>aahadqj</dc:creator>
      <dc:date>2011-02-14T18:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: timechart percentage data - not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43842#M10334</link>
      <description>&lt;P&gt;Getting this error - "Error in 'eval' command: The expression is malformed. Expected )". &lt;/P&gt;

&lt;P&gt;Please help&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2011 18:34:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43842#M10334</guid>
      <dc:creator>aahadqj</dc:creator>
      <dc:date>2011-02-14T18:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: timechart percentage data - not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43843#M10335</link>
      <description>&lt;P&gt;Yes, nick had a typo with a mismatched parenthesis, but all you need to do to fix it is to match them up correctly.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2011 02:46:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43843#M10335</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-02-15T02:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: timechart percentage data - not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43844#M10336</link>
      <description>&lt;P&gt;Thanks Gerald.  my bad for flying blind.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2011 04:53:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43844#M10336</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-02-15T04:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: timechart percentage data - not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43845#M10337</link>
      <description>&lt;P&gt;The timechart can't perform the eval math, my mistake.  As a quick fix to get you going, do the search as you originally had it, but add "by _time" to the end of your stats command.  That will produce the time values you need for the timechart.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2011 08:22:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-percentage-data-not-working/m-p/43845#M10337</guid>
      <dc:creator>Ron_Naken</dc:creator>
      <dc:date>2011-02-15T08:22:12Z</dc:date>
    </item>
  </channel>
</rss>

