<?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 do you handle data that changes over time within the source systems? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419726#M73942</link>
    <description>&lt;P&gt;Can you provide sample data from the DB table?&lt;/P&gt;</description>
    <pubDate>Mon, 08 Oct 2018 11:27:11 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2018-10-08T11:27:11Z</dc:date>
    <item>
      <title>How do you handle data that changes over time within the source systems?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419725#M73941</link>
      <description>&lt;P&gt;Hello Splunkers!!&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Apologies for the wall of text below, but my urge to explain the situation has overcome everything else.&lt;/EM&gt; &lt;BR /&gt;
&lt;STRONG&gt;Scenario:&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;SQL Server stores factory floor data. &lt;/P&gt;

&lt;P&gt;New row is appended for each new Shift. So, we have unique rows for each &lt;STRONG&gt;DAY&lt;/STRONG&gt; and each &lt;STRONG&gt;Shift&lt;/STRONG&gt; that runs at the factory. &lt;/P&gt;

&lt;P&gt;Hence, each combo of DAY-Shift will be unique in the DB. &lt;/P&gt;

&lt;P&gt;For any changes in the data for a DAY_Shift, it is updated in the existing row. &lt;/P&gt;

&lt;P&gt;To allow for corrections, the data for any shift can be updated within a time window of 72hrs from the shift start, after which it is frozen and no further updates can be done. &lt;/P&gt;

&lt;P&gt;A timestamp column [col_TS, factory local time] holds the time of last change/update. Thus, this can be anytime within the next 72hrs of the shift start time. &lt;STRONG&gt;Hence, these updates can be within a span of 3 Days.&lt;/STRONG&gt;  &lt;/P&gt;

&lt;P&gt;DBConnect monitors a Rising Column [col_TS] and index time is also the col_TS timestamp, with properly configured time zones. &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;The problem is with the sentence in bold: &lt;STRONG&gt;&lt;EM&gt;Hence, these updates can be within a span of 3 Days.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;By this logic, data for production day 2018-10-01 [DAY] can come in within the span of 2018-10-01 till 2018-10-04 [col_TS &amp;amp; index _time]. &lt;/P&gt;

&lt;P&gt;Thus I can have multiple entries for &lt;CODE&gt;2018-10-01 - Shift 1&lt;/CODE&gt; over 2018-10-01, 2018-10-02, 2018-10-03 &amp;amp; 2018-10-04 and just pick the latest one. &lt;/P&gt;

&lt;P&gt;However, if a user &lt;STRONG&gt;using the Splunk Time Picker&lt;/STRONG&gt; wants to see a report on a span of time where 2018-10-01 is the last day, the last three day's values will not be the latest. Because Time Picker will translate values into &lt;CODE&gt;earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt; and run them on the first line, against the col_TS and hence filter out all data outside the selected time span. &lt;/P&gt;

&lt;P&gt;How do I get rid of this and use something like &lt;CODE&gt;latest + 72hrs&lt;/CODE&gt;?? &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;. &lt;EM&gt;A dirty workaround that I have thought of is to provide two different time picker buttons that will return epoch time to the SPL query. The Start Time will be a straight conversion. The End Time will be &lt;CODE&gt;User Selected Time + 72hrs&lt;/CODE&gt; converted to epoch.&lt;/EM&gt; &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Regards &amp;amp; Thanks&lt;BR /&gt;
Anirban. &lt;/P&gt;

&lt;P&gt;EDIT: &lt;A href="https://answers.splunk.com/answers/322027/splunk-db-connect-is-there-a-way-to-configure-a-da.html" target="_blank"&gt;https://answers.splunk.com/answers/322027/splunk-db-connect-is-there-a-way-to-configure-a-da.html&lt;/A&gt;&lt;BR /&gt;
@rich7177  's answer is promising. putting that here for my reference. &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;_time                           col_TS                                  Day                 ShiftCode   Quantity&lt;BR /&gt;
2018-10-02 06:10:02 2018-10-02 06:10:02.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 06:10:02 2018-10-02 06:10:02.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 05:52:03 2018-10-02 05:52:03.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 05:37:05 2018-10-02 05:37:05.0   2018-10-01  2   3965.2490000000003&lt;BR /&gt;
2018-10-02 05:37:05 2018-10-02 05:37:05.0   2018-10-01  2   3965.2490000000003&lt;BR /&gt;
2018-10-02 05:24:03 2018-10-02 05:24:03.0   2018-10-01  2   3965.2490000000003&lt;BR /&gt;
2018-10-02 05:24:03 2018-10-02 05:24:03.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 04:52:02 2018-10-02 04:52:02.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 04:52:02 2018-10-02 04:52:02.0   2018-10-01  2   3607.0090000000005&lt;BR /&gt;
2018-10-02 04:24:02 2018-10-02 04:24:02.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 04:24:02 2018-10-02 04:24:02.0   2018-10-01  2   3245.649&lt;BR /&gt;
2018-10-02 03:52:03 2018-10-02 03:52:03.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 03:52:03 2018-10-02 03:52:03.0   2018-10-01  2   2883.799&lt;BR /&gt;
2018-10-02 03:24:02 2018-10-02 03:24:02.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 03:24:02 2018-10-02 03:24:02.0   2018-10-01  2   2883.799&lt;BR /&gt;
2018-10-02 02:52:02 2018-10-02 02:52:02.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 02:52:02 2018-10-02 02:52:02.0   2018-10-01  2   2883.799&lt;BR /&gt;
2018-10-02 02:24:02 2018-10-02 02:24:02.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 02:24:02 2018-10-02 02:24:02.0   2018-10-01  2   2521.799&lt;BR /&gt;
2018-10-02 01:52:02 2018-10-02 01:52:02.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 01:52:02 2018-10-02 01:52:02.0   2018-10-01  2   2521.799&lt;BR /&gt;
2018-10-02 01:24:02 2018-10-02 01:24:02.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 01:24:02 2018-10-02 01:24:02.0   2018-10-01  2   2521.799&lt;BR /&gt;
2018-10-02 00:52:03 2018-10-02 00:52:03.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 00:52:03 2018-10-02 00:52:03.0   2018-10-01  2   2521.799&lt;BR /&gt;
2018-10-02 00:24:03 2018-10-02 00:24:03.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-02 00:24:03 2018-10-02 00:24:03.0   2018-10-01  2   2163.3289999999993&lt;BR /&gt;
2018-10-01 23:52:00 2018-10-01 23:52:00.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-01 23:52:00 2018-10-01 23:52:00.0   2018-10-01  2   1804.4389999999999&lt;BR /&gt;
2018-10-01 23:24:00 2018-10-01 23:24:00.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-01 23:24:00 2018-10-01 23:24:00.0   2018-10-01  2   1442.249&lt;BR /&gt;
2018-10-01 22:52:00 2018-10-01 22:52:00.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-01 22:52:00 2018-10-01 22:52:00.0   2018-10-01  2   1080.5890000000002&lt;BR /&gt;
2018-10-01 22:24:00 2018-10-01 22:24:00.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-01 22:24:00 2018-10-01 22:24:00.0   2018-10-01  2   722.209&lt;BR /&gt;
2018-10-01 21:52:01 2018-10-01 21:52:01.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-01 21:52:01 2018-10-01 21:52:01.0   2018-10-01  2   722.209&lt;BR /&gt;
2018-10-01 21:24:00 2018-10-01 21:24:00.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-01 21:24:00 2018-10-01 21:24:00.0   2018-10-01  2   360.869&lt;BR /&gt;
2018-10-01 20:52:00 2018-10-01 20:52:00.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-01 20:52:00 2018-10-01 20:52:00.0   2018-10-01  2   0.0&lt;BR /&gt;
2018-10-01 20:24:00 2018-10-01 20:24:00.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-01 20:24:00 2018-10-01 20:24:00.0   2018-10-01  2   0.0&lt;BR /&gt;
2018-10-01 19:52:00 2018-10-01 19:52:00.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-01 19:52:00 2018-10-01 19:52:00.0   2018-10-01  2   0.0&lt;BR /&gt;
2018-10-01 19:24:00 2018-10-01 19:24:00.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-01 19:24:00 2018-10-01 19:24:00.0   2018-10-01  2   0.0&lt;BR /&gt;
2018-10-01 18:52:00 2018-10-01 18:52:00.0   2018-10-01  1   689.7239999999999&lt;BR /&gt;
2018-10-01 18:52:00 2018-10-01 18:52:00.0   2018-10-01  2   0.0&lt;BR /&gt;
2018-10-01 18:24:00 2018-10-01 18:24:00.0   2018-10-01  1   689.7239999999999&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:34:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419725#M73941</guid>
      <dc:creator>anirbandasdeb</dc:creator>
      <dc:date>2020-09-29T21:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do you handle data that changes over time within the source systems?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419726#M73942</link>
      <description>&lt;P&gt;Can you provide sample data from the DB table?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 11:27:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419726#M73942</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-10-08T11:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do you handle data that changes over time within the source systems?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419727#M73943</link>
      <description>&lt;P&gt;Okay, the first thing is, the time_picker should not be operating on the ingestion date ( &lt;CODE&gt;_indextime&lt;/CODE&gt; ), it should be working on the date/time of the event ( &lt;CODE&gt;_time&lt;/CODE&gt; ), which is should be being created using a translation of  "2018-10-01 - Shift 1".  Assuming that shift 1 starts at 8:00 AM, an event's &lt;CODE&gt;_time&lt;/CODE&gt; should be being set up as "2018-10-01 08:00:00".   This should be relatively easy to calculate in the process that extracts the data from the SQL data base.&lt;/P&gt;

&lt;P&gt;Second thing, if you can't fix that ingestion, then you can use a single time_picker, and set the &lt;CODE&gt;&amp;lt;change&amp;gt;&lt;/CODE&gt; parameter of the control to calculate another pair of fields... the start and end of the potential time period.  Then, in your SPL, restrict the results to those whose shift falls within the actual time range desired. &lt;/P&gt;

&lt;P&gt;And remember, if Splunk is keeping copies of the same data over time, you are going to need to &lt;CODE&gt;| dedup&lt;/CODE&gt; the search by its key fields in order to keep only the most recent copy, or run a periodic search that finds all duplicate events after the first one and routes them to &lt;CODE&gt;|delete&lt;/CODE&gt; - a capability that is restricted for very good reasons.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:34:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419727#M73943</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2020-09-29T21:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do you handle data that changes over time within the source systems?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419728#M73944</link>
      <description>&lt;P&gt;hi @anirbandasdeb&lt;/P&gt;

&lt;P&gt;Did the answer below solve your problem? If so, please resolve this post by approving it! &lt;BR /&gt;
If your problem is still not solved, keep us updated so that someone else can help ya. Thanks for posting!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 23:15:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419728#M73944</guid>
      <dc:creator>mstjohn_splunk</dc:creator>
      <dc:date>2018-10-08T23:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do you handle data that changes over time within the source systems?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419729#M73945</link>
      <description>&lt;P&gt;added. &lt;/P&gt;

&lt;P&gt;you might need to put this on a spreadsheet to get the layout/column correct. &lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 03:53:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419729#M73945</guid>
      <dc:creator>anirbandasdeb</dc:creator>
      <dc:date>2018-10-09T03:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do you handle data that changes over time within the source systems?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419730#M73946</link>
      <description>&lt;P&gt;will do @mstjohn &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 03:53:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419730#M73946</guid>
      <dc:creator>anirbandasdeb</dc:creator>
      <dc:date>2018-10-09T03:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do you handle data that changes over time within the source systems?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419731#M73947</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;Okay, the first thing is, the&lt;BR /&gt;
time_picker should not be operating on&lt;BR /&gt;
the ingestion date ( _indextime ), it&lt;BR /&gt;
should be working on the date/time of&lt;BR /&gt;
the event ( _time ), which is should&lt;BR /&gt;
be being created using a translation&lt;BR /&gt;
of "2018-10-01 - Shift 1". Assuming&lt;BR /&gt;
that shift 1 starts at 8:00 AM, an&lt;BR /&gt;
event's _time should be being set up&lt;BR /&gt;
as "2018-10-01 08:00:00". This should&lt;BR /&gt;
be relatively easy to calculate in the&lt;BR /&gt;
process that extracts the data from&lt;BR /&gt;
the SQL data base.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;OL&gt;
&lt;LI&gt;The time picker [rather _time] operates on &lt;STRONG&gt;col_TS&lt;/STRONG&gt;. col_TS stores the timestamp of the last update of the row. thus, &lt;CODE&gt;_time == col_TS&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;There are no tables within the db to define Shift timings. We have to pull that from a separate source, Shoplogix, and correlate that. But that would be a lot of rework at this point and I want to avoid that. &lt;/LI&gt;
&lt;/OL&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Second thing, if you can't fix that&lt;BR /&gt;
ingestion, then you can use a single&lt;BR /&gt;
time_picker, and set the &lt;BR /&gt;
parameter of the control to calculate&lt;BR /&gt;
another pair of fields... the start&lt;BR /&gt;
and end of the potential time period.&lt;BR /&gt;
Then, in your SPL, restrict the&lt;BR /&gt;
results to those whose shift falls&lt;BR /&gt;
within the actual time range desired.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;This is rather interesting. &lt;BR /&gt;
I am already using the time picker. I can give this a try. &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;And remember, if Splunk is keeping&lt;BR /&gt;
copies of the same data over time, you&lt;BR /&gt;
are going to need to | dedup the&lt;BR /&gt;
search by its key fields in order to&lt;BR /&gt;
keep only the most recent copy, or run&lt;BR /&gt;
a periodic search that finds all&lt;BR /&gt;
duplicate events after the first one&lt;BR /&gt;
and routes them to |delete - a&lt;BR /&gt;
capability that is restricted for very&lt;BR /&gt;
good reasons.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Yup. I am already taking care of this. Just not though &lt;CODE&gt;| delete&lt;/CODE&gt;. I am particularly wary of using delete. &lt;BR /&gt;
Just using &lt;CODE&gt;stats latest(&amp;lt;blah1&amp;gt;) by Day, Shift&lt;/CODE&gt; to pick the latest from each Day-Shift combo.  &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:34:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419731#M73947</guid>
      <dc:creator>anirbandasdeb</dc:creator>
      <dc:date>2020-09-29T21:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do you handle data that changes over time within the source systems?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419732#M73948</link>
      <description>&lt;P&gt;You can do something like this to always add 72hours to your search from the timepicker (without modifying the timepicker at all):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Base Search String Here
    [| makeresults 
    | rename COMMENT AS "DO NOT CHANGE ANYTHING IN THIS SUBSEARCH SECTION!"
    | addinfo 
    | rename info_min_time AS earliest, info_max_time AS latest 
    | eval old_latest = latest 
    | eval latest=relative_time(latest, "+72h") 
    | table earliest latest 
    | eval search="earliest=" . earliest . " latest=" . latest]
| the | rest | of | your | search | with | pipes | here
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Jan 2019 17:30:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-handle-data-that-changes-over-time-within-the-source/m-p/419732#M73948</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-10T17:30:50Z</dc:date>
    </item>
  </channel>
</rss>

