<?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: Subtract static value from list in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428168#M75023</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt; &lt;BR /&gt;
Yes, there is difference between date format of &lt;CODE&gt;deployment_time&lt;/CODE&gt; and &lt;CODE&gt;commit_date&lt;/CODE&gt; but they both are converted into unix timestamps, which I can see in result as &lt;CODE&gt;deployment_ts&lt;/CODE&gt; and &lt;CODE&gt;commit_ts&lt;/CODE&gt;. I tried the query you asked me.  Here are the results &lt;BR /&gt;
&lt;IMG src="https://files.slack.com/files-pri/T9BL7ND8R-FKPTD0SP7/screen_shot_2019-06-19_at_10.00.57_am.png" alt="alt text" /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 01:00:47 GMT</pubDate>
    <dc:creator>dheri</dc:creator>
    <dc:date>2020-09-30T01:00:47Z</dc:date>
    <item>
      <title>Subtract static value from list</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428165#M75020</link>
      <description>&lt;P&gt;I am trying to get time difference between 2 timestamps, I have one field &lt;CODE&gt;deployment_ts&lt;/CODE&gt; with one value and list of time stamps &lt;CODE&gt;commit_ts&lt;/CODE&gt;, i want a list containing the difference for each value in list with the other field &lt;CODE&gt;eval commit_to_rel =  (deployment_ts - commit_ts)&lt;/CODE&gt;. Bu t I am not getting any result. &lt;/P&gt;

&lt;P&gt;here is my query &lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
index=x application_name="yy-xx-zz" event_type="ev"&lt;BR /&gt;
| spath path=commits{}.date output=commit_date &lt;BR /&gt;
| eval deployment_ts = (strptime(deployment_time, "%Y-%m-%dT%H:%M:%S%z"))&lt;BR /&gt;
| eval commit_ts = (strptime(commit_date, "%Y-%m-%dT%H:%M:%SZ"))&lt;BR /&gt;
| eval commit_to_rel =  (deployment_ts - commit_ts)&lt;BR /&gt;
| stats list(commit_date), list(commit_ts), list(deployment_ts), list(commit_to_rel)&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Can anyone please tell me how to get this done? &lt;/P&gt;

&lt;P&gt;here is the picture of  results along with the querry. &lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/273928-screen-shot-2019-06-18-at-105254-am.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:57:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428165#M75020</guid>
      <dc:creator>dheri</dc:creator>
      <dc:date>2020-09-30T00:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract static value from list</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428166#M75021</link>
      <description>&lt;P&gt;@dheri &lt;/P&gt;

&lt;P&gt;Is the date format for &lt;CODE&gt;deployment_time&lt;/CODE&gt; and &lt;CODE&gt;commit_date&lt;/CODE&gt; are the same? If not, can you please share it else pls try below search? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{\"deployment_time\": \"2019-06-03T15:41:26Z\",\"commit_date\": \"2019-06-03T15:41:26Z\"}" 
| kv 
| eval deployment_ts = (strptime(deployment_time, "%Y-%m-%dT%H:%M:%S%Z")) 
| eval commit_ts = (strptime(commit_date, "%Y-%m-%dT%H:%M:%SZ")) 
| eval commit_to_rel = (deployment_ts - commit_ts)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Just made change in &lt;CODE&gt;| eval deployment_ts = (strptime(deployment_time, "%Y-%m-%dT%H:%M:%S%Z"))&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 07:30:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428166#M75021</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-06-19T07:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract static value from list</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428167#M75022</link>
      <description>&lt;P&gt;Hi @dheri,&lt;/P&gt;

&lt;P&gt;Try this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=x application_name="yy-xx-zz" event_type="ev"
| spath path=commits{}.date output=commit_date 
| eval deployment_ts = (strptime(deployment_time, "%Y-%m-%dT%H:%M:%S%Z"))
| eval commit_ts = (strptime(commit_ts, "%Y-%m-%dT%H:%M:%SZ"))
| mvexpand commit_ts
| eval commit_to_rel =  (deployment_ts - commit_ts)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if that helps.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 10:00:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428167#M75022</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-06-19T10:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract static value from list</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428168#M75023</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt; &lt;BR /&gt;
Yes, there is difference between date format of &lt;CODE&gt;deployment_time&lt;/CODE&gt; and &lt;CODE&gt;commit_date&lt;/CODE&gt; but they both are converted into unix timestamps, which I can see in result as &lt;CODE&gt;deployment_ts&lt;/CODE&gt; and &lt;CODE&gt;commit_ts&lt;/CODE&gt;. I tried the query you asked me.  Here are the results &lt;BR /&gt;
&lt;IMG src="https://files.slack.com/files-pri/T9BL7ND8R-FKPTD0SP7/screen_shot_2019-06-19_at_10.00.57_am.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:00:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428168#M75023</guid>
      <dc:creator>dheri</dc:creator>
      <dc:date>2020-09-30T01:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract static value from list</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428169#M75024</link>
      <description>&lt;P&gt;Hi @dheri Was that helpful ? Can you let me know if it worked for you ?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 15:11:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428169#M75024</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-06-19T15:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract static value from list</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428170#M75025</link>
      <description>&lt;P&gt;Yes, I was able to expand single event into multiple events.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 15:13:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428170#M75025</guid>
      <dc:creator>dheri</dc:creator>
      <dc:date>2019-06-19T15:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract static value from list</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428171#M75026</link>
      <description>&lt;P&gt;Awesome ! Great to hear that !&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 15:14:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Subtract-static-value-from-list/m-p/428171#M75026</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-06-19T15:14:48Z</dc:date>
    </item>
  </channel>
</rss>

