<?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 convert values in milliseconds to seconds and minutes? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220701#M64836</link>
    <description>&lt;P&gt;Hi muebel,&lt;BR /&gt;
thanks, I tried that also no luck. &lt;BR /&gt;
I also figure out how to check the event type and it is a number so for some reason any operation doing to it converts it to a null value, I am starting to think that may be a bug.&lt;/P&gt;

&lt;P&gt;rgds,&lt;BR /&gt;
Juan&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2016 18:39:56 GMT</pubDate>
    <dc:creator>jperezes</dc:creator>
    <dc:date>2016-02-25T18:39:56Z</dc:date>
    <item>
      <title>How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220694#M64829</link>
      <description>&lt;P&gt;Hi all and thanks in advance,&lt;/P&gt;

&lt;P&gt;I am trying to get statistics for a value that is given in milliseconds, so I would need to transform them to seconds and eventually minutes. I tried everything my common sense dictated, but that simple operation seems not to be that trivial.&lt;/P&gt;

&lt;P&gt;I do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search value_in_ms | eval valueSeconds=value_in_ms/1000 | timechart span=1d perc25(valueSeconds)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that does not work, so tried this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search value_in_ms | timechart span=1d perc25(eval(value_in_ms/1000 ))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;does not work either. Anything I do to value_in_ms generates an empty output...&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Juan&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:55:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220694#M64829</guid>
      <dc:creator>jperezes</dc:creator>
      <dc:date>2020-09-29T08:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220695#M64830</link>
      <description>&lt;P&gt;Check if the value_in_ms is numeric or not. Try to convert to number before using it.&lt;/P&gt;

&lt;P&gt;search value_in_ms | eval valueSeconds=tonumber(value_in_ms)/1000 | timechart span=1d perc25(valueSeconds)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:54:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220695#M64830</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T08:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220696#M64831</link>
      <description>&lt;P&gt;Hi somesoni2,&lt;/P&gt;

&lt;P&gt;thanks for your reply, I tried that but doesn't work. It seems everything touched by eval goes to null.&lt;/P&gt;

&lt;P&gt;For example if I do that:&lt;/P&gt;

&lt;P&gt;search value_in_ms | timechart span=1d perc25(value_in_ms)&lt;/P&gt;

&lt;P&gt;there is no problem and works fine, I get the graph correctly. But if I do this:&lt;/P&gt;

&lt;P&gt;search value_in_ms | eval newvalue=value_in_ms |timechart span=1d perc25(newvalue)&lt;/P&gt;

&lt;P&gt;Then got nothing, like if the eval is messing things up....&lt;/P&gt;

&lt;P&gt;Rgds,&lt;/P&gt;

&lt;P&gt;Juan&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:55:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220696#M64831</guid>
      <dc:creator>jperezes</dc:creator>
      <dc:date>2020-09-29T08:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220697#M64832</link>
      <description>&lt;P&gt;It seems that you are barking up the right tree, you are correct that this should be a trivial task. For reference, the eval documentation can be found here : &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/Eval" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/Eval&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;As somesoni2 mentioned, this could be related to the format of the 'value_in_ms' field, and so the tonumber function might help.&lt;/P&gt;

&lt;P&gt;Please let me know if this helps, and otherwise could you post an example of the results you get?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:55:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220697#M64832</guid>
      <dc:creator>muebel</dc:creator>
      <dc:date>2020-09-29T08:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220698#M64833</link>
      <description>&lt;P&gt;Hi muebel,&lt;/P&gt;

&lt;P&gt;Thanks for your interest I found an example in the doc that is exactly what I want to do. But no luck, actually I tried somesoni2 suggestion and is not working either, my thoughts are that eval for some reasons I don't reach to figure out is changing the format of the variable.&lt;/P&gt;

&lt;P&gt;This works fine&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search time_in_ms | timechart perc75(time_in_ms)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so I guess time_in_ms is a number variable as I can get the percentile.&lt;/P&gt;

&lt;P&gt;If I do the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search time_in_ms | eval newtime=time_in_ms | timechart perc75(newtime)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I got nothing and theoretically there would be not difference between both searches.&lt;/P&gt;

&lt;P&gt;that's exactly what I have and the result is nothing.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;value.clientCallDuration &amp;gt; 0 | eval duration = tonumber(value.clientCallDuration)/1000 |
timechart span=1d  perc25(duration) as "25th %" perc50(duration) as "50th %" perc75(duration) as "75th %"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but the follwoing works:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;value.clientCallDuration &amp;gt; 0 | timechart span=1d  perc25(value.clientCallDuration) as "25th %" perc50(value.clientCallDuration) as "50th %" perc75(value.clientCallDuration) as "75th %"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am very confused, is there a way to know what format is splunk interpreting clientCallDuration?&lt;/P&gt;

&lt;P&gt;Many thanks,&lt;/P&gt;

&lt;P&gt;Juan&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:56:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220698#M64833</guid>
      <dc:creator>jperezes</dc:creator>
      <dc:date>2020-09-29T08:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220699#M64834</link>
      <description>&lt;P&gt;Hi again muebel,&lt;/P&gt;

&lt;P&gt;I did some tests and problem seems to be in the format, I have been searching around and haven't found any other case, that is very weird.&lt;BR /&gt;
Number passed to JSON is a long, if is not used in the eval statement then can be used to perform operations and indeed it gets correct result when I do stuff like perc25.&lt;BR /&gt;
If I modify the value with eval, then it always return null. Some examples&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; eval time = timems  ---&amp;gt; time will be null even if timems is not. 
 eval time = if(timems&amp;gt;1, "ok","notok") --- &amp;gt; that returns an error stating '&amp;gt;' comparin different formats. 
 eval time=if(timems&amp;gt;"1",'ok","error") ---&amp;gt; statement is always false (in reality is not) so always would return error (timems is set to null)
 eval time=tonumber(timems)  ---&amp;gt; time is always null.
 convert num(timems) ----&amp;gt; timems is always null
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Rgds,&lt;/P&gt;

&lt;P&gt;Juan&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 16:56:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220699#M64834</guid>
      <dc:creator>jperezes</dc:creator>
      <dc:date>2016-02-25T16:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220700#M64835</link>
      <description>&lt;P&gt;maybe &lt;BR /&gt;
    timechart perc75(time_in_ms/1000)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:56:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220700#M64835</guid>
      <dc:creator>muebel</dc:creator>
      <dc:date>2020-09-29T08:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220701#M64836</link>
      <description>&lt;P&gt;Hi muebel,&lt;BR /&gt;
thanks, I tried that also no luck. &lt;BR /&gt;
I also figure out how to check the event type and it is a number so for some reason any operation doing to it converts it to a null value, I am starting to think that may be a bug.&lt;/P&gt;

&lt;P&gt;rgds,&lt;BR /&gt;
Juan&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 18:39:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220701#M64836</guid>
      <dc:creator>jperezes</dc:creator>
      <dc:date>2016-02-25T18:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220702#M64837</link>
      <description>&lt;P&gt;try using &lt;STRONG&gt;eval valueSeconds=round((value_in_ms/1000),2)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:56:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220702#M64837</guid>
      <dc:creator>prachisaxena</dc:creator>
      <dc:date>2020-09-29T08:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220703#M64838</link>
      <description>&lt;P&gt;Hi prachisaxena,&lt;/P&gt;

&lt;P&gt;Tried but says  "Error in 'eval' command: The arguments to the 'round' function are invalid.". What I suspect is takeing call_in_ms as something different than number, but actually if I inspect the element it says is a number. &lt;/P&gt;

&lt;P&gt;Thanks for your reply.&lt;BR /&gt;
Juan&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:56:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220703#M64838</guid>
      <dc:creator>jperezes</dc:creator>
      <dc:date>2020-09-29T08:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220704#M64839</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;

&lt;P&gt;Can you try to do isnum() or isint() and see if it gives TRUE&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 10:53:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220704#M64839</guid>
      <dc:creator>prachisaxena</dc:creator>
      <dc:date>2016-02-29T10:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220705#M64840</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Ya I did that:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval result= if(isint(callDurationMS),"ok","nook") | timechart span=1d count by result
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;all printed is "nook", same result for isnum. &lt;BR /&gt;
So is not detected as number but if I don't filter it and use it straight in &lt;CODE&gt;perc25(callDurationMS)&lt;/CODE&gt; is treated as a number,or that seems so as it works, and if I inspect "Select Fields" callDurationMS sayst Type:Number, I cannot paste the image.&lt;/P&gt;

&lt;P&gt;Rgds,&lt;BR /&gt;
Juan&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 11:03:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220705#M64840</guid>
      <dc:creator>jperezes</dc:creator>
      <dc:date>2016-02-29T11:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220706#M64841</link>
      <description>&lt;P&gt;Can you send me some sample text .. let me try&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 11:14:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220706#M64841</guid>
      <dc:creator>prachisaxena</dc:creator>
      <dc:date>2016-02-29T11:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220707#M64842</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Do you mean the JSON raw data?, this is a sample:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  {  
      callDurationMS:  30000 
      callId:  c1cefd39d2cc 
      callStartTime:  2016-02-27T06:01:33.986Z 
      metricType:  CALL 
   }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My working search is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;metricType="CALL" callDurationMS &amp;gt; 100  |timechart span=1d  perc25(callDurationM) as "25th %" perc50(callDurationM) as "50th %" perc75(callDurationM) as "75th %" count(callDurationM)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if I add the eval parameters callDurationMS goes to null, and there is no output.&lt;/P&gt;

&lt;P&gt;Rgds&lt;/P&gt;

&lt;P&gt;Juan&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 11:23:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220707#M64842</guid>
      <dc:creator>jperezes</dc:creator>
      <dc:date>2016-02-29T11:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert values in milliseconds to seconds and minutes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220708#M64843</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I found the problem it was quite an stupid thing... in the eval, the variable has to go with single quotes, so the following is working:&lt;/P&gt;

&lt;P&gt;search time_in_ms | eval newtime=round(&lt;STRONG&gt;'time_in_ms'&lt;/STRONG&gt;/1000) &lt;/P&gt;

&lt;P&gt;while this is failing:&lt;BR /&gt;
search time_in_ms | eval newtime=round(time_in_ms/1000) &lt;/P&gt;

&lt;P&gt;thanks,&lt;/P&gt;

&lt;P&gt;Juan&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:57:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-values-in-milliseconds-to-seconds-and-minutes/m-p/220708#M64843</guid>
      <dc:creator>jperezes</dc:creator>
      <dc:date>2020-09-29T08:57:05Z</dc:date>
    </item>
  </channel>
</rss>

