<?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 in a Splunk Dashboard, how do you calculate the time difference between now and start time ? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414854#M42504</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I have a Splunk dashboard in which I have to divide my total by seconds (Please refer below 3600). Instead of hard coding, I have to do a divide by difference between start time and now .&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval TPS=Round((Total/**3600**),2) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I.e., if I select and search for time range between 03/05/2019 04:00:00 AM to 03/05/2019 06:00:00 AM , it should return a value which i can substitute using a variable in the below eval function.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval TPS=Round((Total/**some_variable**),2) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help is much appreciated .!!!!&lt;/P&gt;

&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2019 12:36:48 GMT</pubDate>
    <dc:creator>jagadeeshvenkat</dc:creator>
    <dc:date>2019-03-05T12:36:48Z</dc:date>
    <item>
      <title>in a Splunk Dashboard, how do you calculate the time difference between now and start time ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414854#M42504</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I have a Splunk dashboard in which I have to divide my total by seconds (Please refer below 3600). Instead of hard coding, I have to do a divide by difference between start time and now .&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval TPS=Round((Total/**3600**),2) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I.e., if I select and search for time range between 03/05/2019 04:00:00 AM to 03/05/2019 06:00:00 AM , it should return a value which i can substitute using a variable in the below eval function.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval TPS=Round((Total/**some_variable**),2) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help is much appreciated .!!!!&lt;/P&gt;

&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 12:36:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414854#M42504</guid>
      <dc:creator>jagadeeshvenkat</dc:creator>
      <dc:date>2019-03-05T12:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: in a Splunk Dashboard, how do you calculate the time difference between now and start time ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414855#M42505</link>
      <description>&lt;P&gt;@jagadeeshvenkatesh1,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;now() - $your_time_token.earliest$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;updated:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval starttime=if(match("$field1.earliest$","^(\d+)"),"$field1.earliest$",relative_time(now(),"$field1.earliest$"))
|eval TPS=Round((Total/(now() - starttime)),2) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Mar 2019 12:42:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414855#M42505</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-03-05T12:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: in a Splunk Dashboard, how do you calculate the time difference between now and start time ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414856#M42506</link>
      <description>&lt;P&gt;thanks @renjith.nair  . if i use &lt;BR /&gt;
&lt;STRONG&gt;| eval TPS=Round((Total/(now() - $field1.earliest$)),2)&lt;/STRONG&gt; &lt;BR /&gt;
, i getting  an error like "error in 'eval' command. the expression is malperformed  Expected )". &lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 12:51:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414856#M42506</guid>
      <dc:creator>jagadeeshvenkat</dc:creator>
      <dc:date>2019-03-05T12:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: in a Splunk Dashboard, how do you calculate the time difference between now and start time ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414857#M42507</link>
      <description>&lt;P&gt;okie, thats because you might be using relative time (-1d,-1m etc).&lt;/P&gt;

&lt;P&gt;Try this then&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval starttime=if(match("$field1.earliest$","^(\d+)"),"$field1.earliest$",relative_time(now(),"$field1.earliest$"))
| eval TPS=Round((Total/(now() - starttime)),2) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Mar 2019 13:07:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414857#M42507</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-03-05T13:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: in a Splunk Dashboard, how do you calculate the time difference between now and start time ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414858#M42508</link>
      <description>&lt;P&gt;That's awesome.. it worked .. My long time change in my prod dashboard is done because of you.&lt;BR /&gt;
Thanks for that @renjith.nair .  it means a lot.!  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 13:36:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414858#M42508</guid>
      <dc:creator>jagadeeshvenkat</dc:creator>
      <dc:date>2019-03-05T13:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: in a Splunk Dashboard, how do you calculate the time difference between now and start time ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414859#M42509</link>
      <description>&lt;P&gt;index="*" |eval check_in=check_in |eval check_out=check_out |eval it = strptime(check_in, "%H:%M:%S") &lt;BR /&gt;
 | eval ot = strptime(check_out, "%H:%M:%S") | eval diff=ot-it |eval diff1 = tostring(diff, "duration") &lt;BR /&gt;
i was trying to get duration between checkin and check out but i am getting only 1 person duration please check and let me know soon&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:47:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/in-a-Splunk-Dashboard-how-do-you-calculate-the-time-difference/m-p/414859#M42509</guid>
      <dc:creator>nainanayana</dc:creator>
      <dc:date>2020-09-30T00:47:18Z</dc:date>
    </item>
  </channel>
</rss>

