<?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 Subtracts two time field showing null result in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564023#M100459</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have my query below, i used query from "Solved" questions on community, however its showing NULL result for me.&lt;BR /&gt;&lt;BR /&gt;Query --&lt;BR /&gt;&lt;BR /&gt;index=victorops sourcetype="splunk:victorops:incidents:json" "PTS"&lt;BR /&gt;| dedup incidentNumber&lt;BR /&gt;| eval startTimeFormatted=strptime(startTime,"%Y-%m-%dT%H:%M:%SZ") -18000&lt;BR /&gt;| eval SplunkStartTime=strftime(startTimeFormatted,"%m/%d/%y %H:%M:%S")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;| eval endTimeFormatted=strptime(lastAlertTime,"%Y-%m-%dT%H:%M:%SZ") -18000&lt;BR /&gt;| eval SplunkEndTime=strftime(endTimeFormatted,"%m/%d/%y %H:%M:%S")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;| eval MTTR = round((SplunkEndTime-SplunkStartTime)/86400)&lt;BR /&gt;| table incidentNumber, SplunkStartTime,&amp;nbsp;routingKey, entityDisplayName,&amp;nbsp;SplunkEndTime, currentPhase, MTTR&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Above query&amp;nbsp; showing "NULL" output to "MTTR" field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise !&lt;/P&gt;</description>
    <pubDate>Fri, 20 Aug 2021 05:14:18 GMT</pubDate>
    <dc:creator>Manasi25</dc:creator>
    <dc:date>2021-08-20T05:14:18Z</dc:date>
    <item>
      <title>Subtracts two time field showing null result</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564023#M100459</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have my query below, i used query from "Solved" questions on community, however its showing NULL result for me.&lt;BR /&gt;&lt;BR /&gt;Query --&lt;BR /&gt;&lt;BR /&gt;index=victorops sourcetype="splunk:victorops:incidents:json" "PTS"&lt;BR /&gt;| dedup incidentNumber&lt;BR /&gt;| eval startTimeFormatted=strptime(startTime,"%Y-%m-%dT%H:%M:%SZ") -18000&lt;BR /&gt;| eval SplunkStartTime=strftime(startTimeFormatted,"%m/%d/%y %H:%M:%S")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;| eval endTimeFormatted=strptime(lastAlertTime,"%Y-%m-%dT%H:%M:%SZ") -18000&lt;BR /&gt;| eval SplunkEndTime=strftime(endTimeFormatted,"%m/%d/%y %H:%M:%S")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;| eval MTTR = round((SplunkEndTime-SplunkStartTime)/86400)&lt;BR /&gt;| table incidentNumber, SplunkStartTime,&amp;nbsp;routingKey, entityDisplayName,&amp;nbsp;SplunkEndTime, currentPhase, MTTR&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Above query&amp;nbsp; showing "NULL" output to "MTTR" field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise !&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 05:14:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564023#M100459</guid>
      <dc:creator>Manasi25</dc:creator>
      <dc:date>2021-08-20T05:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracts two time field showing null result</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564034#M100460</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;you cannot calculate with string fields. You must use those with numeric values. In your case those are&amp;nbsp;&lt;SPAN&gt;startTimeFormatted and&amp;nbsp;endTimeFormatted.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you would like to see MTTR as human&amp;nbsp;readable convert it with&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;eval MTTR = tostring(MTTR, "duration")&lt;/LI-CODE&gt;&lt;P&gt;after calculation.&lt;/P&gt;&lt;P&gt;r. Ismo&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 06:56:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564034#M100460</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-08-20T06:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracts two time field showing null result</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564173#M100478</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Thank you !&amp;nbsp;&lt;BR /&gt;I used this and this shows "00:00:00" result to all time spam. PFA&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Please advise further!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Aug 2021 06:08:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564173#M100478</guid>
      <dc:creator>Manasi25</dc:creator>
      <dc:date>2021-08-21T06:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracts two time field showing null result</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564180#M100479</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval MTTR = tostring(round((endTimeFormatted-startTimeFormatted)/86400),"duration")&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 21 Aug 2021 08:49:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564180#M100479</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-08-21T08:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracts two time field showing null result</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564618#M100519</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I searched with your query and still getting "00:00:00" result to all rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PFA. please help !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 00:59:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564618#M100519</guid>
      <dc:creator>Manasi25</dc:creator>
      <dc:date>2021-08-25T00:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracts two time field showing null result</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564668#M100521</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval MTTR = tostring(endTimeFormatted-startTimeFormatted,"duration")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 25 Aug 2021 09:34:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564668#M100521</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-08-25T09:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracts two time field showing null result</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564697#M100526</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/224603"&gt;@Manasi25&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Since the time fields are string formatted, MTTR calculation is not possible. Please try below options;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;in days;
| eval MTTR =round((lastAlertTime-startTime)/86400)

OR formatted as duration; 
| eval MTTR = tostring(lastAlertTime-startTime, "duration")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 12:46:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564697#M100526</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-08-25T12:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracts two time field showing null result</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564743#M100528</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This helps and result is good. Thank you !&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 15:04:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtracts-two-time-field-showing-null-result/m-p/564743#M100528</guid>
      <dc:creator>Manasi25</dc:creator>
      <dc:date>2021-08-25T15:04:39Z</dc:date>
    </item>
  </channel>
</rss>

