<?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: how to divide two fields in a search and print the result values in timechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313369#M163451</link>
    <description>&lt;P&gt;you can try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="demo1" |eval result = total_bytes / total_time | timechart span=1h values(result)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;specify &lt;CODE&gt;span&lt;/CODE&gt; accordingly you can specify anything I have specified as &lt;CODE&gt;1 hour&lt;/CODE&gt;&lt;BR /&gt;
Using this query you might get multiple results for one timestamp as there can be multiple results within that time period.&lt;/P&gt;

&lt;P&gt;If you want to sum all the time for that time period you can use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="demo1" |eval result=total_bytes / total_time | timechart span=1h sum(result)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jan 2018 09:42:11 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2018-01-22T09:42:11Z</dc:date>
    <item>
      <title>how to divide two fields in a search and print the result values in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313368#M163450</link>
      <description>&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/225797-error-division-splunk.jpg" alt="alt text" /&gt;Hi,&lt;/P&gt;

&lt;P&gt;suppose a query is like:       index="demo1" total_bytes,total_time,date etc&lt;BR /&gt;
I need to divide total_bytes/total_time from each record and show the value in timechart.&lt;/P&gt;

&lt;P&gt;index="demo1" |eval result = total_bytes / total_time | timechart result&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:42:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313368#M163450</guid>
      <dc:creator>sawgata12345</dc:creator>
      <dc:date>2020-09-29T17:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to divide two fields in a search and print the result values in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313369#M163451</link>
      <description>&lt;P&gt;you can try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="demo1" |eval result = total_bytes / total_time | timechart span=1h values(result)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;specify &lt;CODE&gt;span&lt;/CODE&gt; accordingly you can specify anything I have specified as &lt;CODE&gt;1 hour&lt;/CODE&gt;&lt;BR /&gt;
Using this query you might get multiple results for one timestamp as there can be multiple results within that time period.&lt;/P&gt;

&lt;P&gt;If you want to sum all the time for that time period you can use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="demo1" |eval result=total_bytes / total_time | timechart span=1h sum(result)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 09:42:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313369#M163451</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-22T09:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to divide two fields in a search and print the result values in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313370#M163452</link>
      <description>&lt;P&gt;index="demo1" sourcetype="demo1"&lt;BR /&gt;
| timechart eval(avg(total_bytes)/avg(total_time)) as result&lt;/P&gt;

&lt;P&gt;As the error states you need to use a function in your timechart (like avg or max)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:42:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313370#M163452</guid>
      <dc:creator>erikgrasman</dc:creator>
      <dc:date>2020-09-29T17:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to divide two fields in a search and print the result values in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313371#M163453</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
ya it helped a bit.&lt;BR /&gt;
I  used &lt;BR /&gt;
index="demo1" earliest=-7d@w1 latest=@w6 |eval res= total_write_io_bytes/total_write_io_count |timechart values(res)&lt;/P&gt;

&lt;P&gt;its actually adding all the res for one day and showing single. for the past week each day value is showing as total of the day.&lt;BR /&gt;
&lt;A href="https://unsee.cc/c8d8030b/" target="_blank"&gt;https://unsee.cc/c8d8030b/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I need it per record basis as and when data comes in, for each record evaluate the value of total_write_io_bytes/total_write_io_count and show in time series as continuous basis.&lt;BR /&gt;
(after each 10 sec data is coming in, so it should show multiple records in timechart for a single day itself)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:42:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313371#M163453</guid>
      <dc:creator>sawgata12345</dc:creator>
      <dc:date>2020-09-29T17:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to divide two fields in a search and print the result values in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313372#M163454</link>
      <description>&lt;P&gt;&lt;CODE&gt;|timechart values(res)&lt;/CODE&gt; will not add up. this command will give you all the results in that time period.&lt;BR /&gt;
If you want per event basis time then you can do something like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="demo1" earliest=-7d@w1 latest=@w6 |eval res= total_write_io_bytes/total_write_io_count | bin _time span=1d |  eval _time=strftime(_time,"%Y-%m-%d") | chart count over res by _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="demo1" earliest=-7d@w1 latest=@w6 |eval res= total_write_io_bytes/total_write_io_count | timechart count by res
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 11:38:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313372#M163454</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-22T11:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to divide two fields in a search and print the result values in timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313373#M163455</link>
      <description>&lt;P&gt;thanks&lt;BR /&gt;
it works&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 12:34:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-divide-two-fields-in-a-search-and-print-the-result-values/m-p/313373#M163455</guid>
      <dc:creator>sawgata12345</dc:creator>
      <dc:date>2018-01-22T12:34:08Z</dc:date>
    </item>
  </channel>
</rss>

