<?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: convert verbose human readble time to splunktime in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/convert-verbose-human-readble-time-to-splunktime/m-p/191061#M38040</link>
    <description>&lt;P&gt;ok, so (for now) i do this:&lt;/P&gt;

&lt;P&gt;index="jira_summary" project="xxxxx" status!="Closed" aggregatetimespent=* | eval age=aggregatetimespent | eval minutes = if(match(age, "minute"), replace(age, ".&lt;EM&gt;?(\d+)\sminute.&lt;/EM&gt;", "\1"), 0) | eval hours = if(match(age, "hour"), replace(age, ".&lt;EM&gt;?(\d+)\shour.&lt;/EM&gt;", "\1"), 0) | eval days = if(match(age, "day"), replace(age, ".&lt;EM&gt;?(\d+)\s*day.&lt;/EM&gt;", "\1"), 0) | eval age_seconds = minutes*60 + hours*3600 + days*86400 | sort age_seconds | eval timespent=tostring(age_seconds,"duration")| table title,assignee,timespent&lt;/P&gt;

&lt;P&gt;the "timespent" is not sortable so i use the temp field.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 15:32:59 GMT</pubDate>
    <dc:creator>dominiquevocat</dc:creator>
    <dc:date>2020-09-28T15:32:59Z</dc:date>
    <item>
      <title>convert verbose human readble time to splunktime</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-verbose-human-readble-time-to-splunktime/m-p/191059#M38038</link>
      <description>&lt;P&gt;Hi, i got some results that contain a arbitrary amount of time (from Jira) that has a human readable structure which i would however like to convert to a splunk timespan so i can sort results.&lt;/P&gt;

&lt;P&gt;example strings would be:&lt;BR /&gt;
6 hours, 17 minutes&lt;BR /&gt;
20 minutes&lt;BR /&gt;
1 day, 1 hour, 20 minutes&lt;BR /&gt;
5 hours, 10 minutes&lt;BR /&gt;
1 day, 1 hour, 19 minutes&lt;BR /&gt;
6 hours, 30 minutes&lt;BR /&gt;
7 hours, 31 minutes&lt;BR /&gt;
6 hours, 2 minutes&lt;BR /&gt;
5 hours, 55 minutes&lt;BR /&gt;
45 minutes&lt;/P&gt;

&lt;P&gt;could potentially contain weeks, months etc...&lt;/P&gt;

&lt;P&gt;How would i best convert it so i can sort the value or chart results based on percentage of total of all values etc...&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2013 14:12:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-verbose-human-readble-time-to-splunktime/m-p/191059#M38038</guid>
      <dc:creator>dominiquevocat</dc:creator>
      <dc:date>2013-12-27T14:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: convert verbose human readble time to splunktime</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-verbose-human-readble-time-to-splunktime/m-p/191060#M38039</link>
      <description>&lt;P&gt;If you really have no way of getting a machine-readable representation of the age, you can roll your own parsing of this using regular expressions. Here's a start using minutes, hours, and days only:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval age = "1 day, 1 hour, 20 minutes" | eval minutes = if(match(age, "minute"), replace(age, ".*?(\d+)\sminute.*", "\1"), 0) | eval hours = if(match(age, "hour"), replace(age, ".*?(\d+)\shour.*", "\1"), 0) | eval days = if(match(age, "day"), replace(age, ".*?(\d+)\s*day.*", "\1"), 0) | eval age_seconds = minutes*60 + hours*3600 + days*86400
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can extend that to include any unit you need, and move some of that to macros (maybe even passing the unit as a parameter to a generic macro) to clean up the clutter.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2013 14:25:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-verbose-human-readble-time-to-splunktime/m-p/191060#M38039</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-12-27T14:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: convert verbose human readble time to splunktime</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/convert-verbose-human-readble-time-to-splunktime/m-p/191061#M38040</link>
      <description>&lt;P&gt;ok, so (for now) i do this:&lt;/P&gt;

&lt;P&gt;index="jira_summary" project="xxxxx" status!="Closed" aggregatetimespent=* | eval age=aggregatetimespent | eval minutes = if(match(age, "minute"), replace(age, ".&lt;EM&gt;?(\d+)\sminute.&lt;/EM&gt;", "\1"), 0) | eval hours = if(match(age, "hour"), replace(age, ".&lt;EM&gt;?(\d+)\shour.&lt;/EM&gt;", "\1"), 0) | eval days = if(match(age, "day"), replace(age, ".&lt;EM&gt;?(\d+)\s*day.&lt;/EM&gt;", "\1"), 0) | eval age_seconds = minutes*60 + hours*3600 + days*86400 | sort age_seconds | eval timespent=tostring(age_seconds,"duration")| table title,assignee,timespent&lt;/P&gt;

&lt;P&gt;the "timespent" is not sortable so i use the temp field.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:32:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/convert-verbose-human-readble-time-to-splunktime/m-p/191061#M38040</guid>
      <dc:creator>dominiquevocat</dc:creator>
      <dc:date>2020-09-28T15:32:59Z</dc:date>
    </item>
  </channel>
</rss>

