<?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 can I keep track of IDs that come from different sources in the same index? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306066#M57725</link>
    <description>&lt;P&gt;Hi Mike6960,&lt;BR /&gt;
if I have correctly understood, try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search
| stats values(Date_1) AS Date_1 values(Date_2) AS Date_2 values(code) AS code) count by id 
| where count =1
| eval Date_3=strftime(strptime(Date_2,"%d-%m-%Y")-strptime(Date_1,"%d-%m-%Y"),"%d-%m-%Y")
| table id Date_3 code
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 13 Oct 2017 11:55:29 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2017-10-13T11:55:29Z</dc:date>
    <item>
      <title>How can I keep track of IDs that come from different sources in the same index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306065#M57724</link>
      <description>&lt;P&gt;I am trying in splunk to monitor the progress of certain id’s which come from two different sources but in the same index.&lt;BR /&gt;
From source one there is a DB-query which is executed once a day. This generates something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ID Date_1           Date_2 Status
1   2-1-2017             23-9-2016  Y
2   23-3-2017           16-1-2017   x
3   16-6-2017           4-3-2017     y
4    12-12-2016           01-10-2017   y
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The next day it may generated this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ID  Date_1           Date_2 Status
1   1-1-2017             23-9-2016  X
2   23-3-2017           16-1-2017   x
3   16-6-2017           4-3-2017     y
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In total in the index I have this after two runs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ID  Date_1           Date_2 Status
1   1-1-2017              23-9-2016 X
1   2-1-2017              23-9-2016 Y
2   23-3-2017            16-1-2017  x
2   23-3-2017            16-1-2017  x
3   16-6-2017            4-3-2017    y
4    12-12-2016            01-10-2017   y
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see has Id 2 no changes but is still inserted twice of course and id 4 has disappeared in the next day because it has moved to another process. &lt;BR /&gt;
ID 4 is now in the next process en will show in the other query from the second source. The output for this will be something like this:&lt;/P&gt;

&lt;P&gt;id  Date_3                code&lt;BR /&gt;
4   10-10-2017        A4&lt;/P&gt;

&lt;P&gt;I want to show the transit times (?) of each unique ID. Over time counting from today (NOW()) &lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 07:06:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306065#M57724</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-10-13T07:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: How can I keep track of IDs that come from different sources in the same index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306066#M57725</link>
      <description>&lt;P&gt;Hi Mike6960,&lt;BR /&gt;
if I have correctly understood, try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search
| stats values(Date_1) AS Date_1 values(Date_2) AS Date_2 values(code) AS code) count by id 
| where count =1
| eval Date_3=strftime(strptime(Date_2,"%d-%m-%Y")-strptime(Date_1,"%d-%m-%Y"),"%d-%m-%Y")
| table id Date_3 code
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 11:55:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306066#M57725</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-13T11:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I keep track of IDs that come from different sources in the same index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306067#M57726</link>
      <description>&lt;P&gt;Hai Giuseppe, thanks, but Date_3 is also a value and not calculated from date_1 and date_2&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:14:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306067#M57726</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2020-09-29T16:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: How can I keep track of IDs that come from different sources in the same index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306068#M57727</link>
      <description>&lt;P&gt;In this case add this additional fields to your stats using values function&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; your_search
 | stats values(Date_1) AS Date_1 values(Date_2) AS Date_2 values(Date_3) AS Date_3 values(code) AS code count by id 
 | where count =1
 | table id Date_3 code
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 12:22:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306068#M57727</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-13T12:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: How can I keep track of IDs that come from different sources in the same index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306069#M57728</link>
      <description>&lt;P&gt;Great Thanks now I only have to figure the time (in days ) between each date&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 12:52:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306069#M57728</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-10-13T12:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I keep track of IDs that come from different sources in the same index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306070#M57729</link>
      <description>&lt;P&gt;It's easy&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Diff=(strptime(Date_2,"%d-%m-%Y")-strptime(Date_1,"%d-%m-%Y"))/86400
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or if you prefer more detailed&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Diff=tostring(strptime(Date_2,"%d-%m-%Y")-strptime(Date_1,"%d-%m-%Y")),"duration")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;

&lt;P&gt;P.S.: if you're satisfied by this answer please remember to accept or upvote it.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 12:56:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306070#M57729</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-13T12:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can I keep track of IDs that come from different sources in the same index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306071#M57730</link>
      <description>&lt;P&gt;Could you just dedup them at the end?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2017 03:18:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-keep-track-of-IDs-that-come-from-different-sources-in/m-p/306071#M57730</guid>
      <dc:creator>troyward</dc:creator>
      <dc:date>2017-10-14T03:18:55Z</dc:date>
    </item>
  </channel>
</rss>

