<?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: Problems with dedup dropping too many records? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-dedup-dropping-too-many-records/m-p/633226#M219976</link>
    <description>&lt;P&gt;Edit: Maybe this&amp;nbsp;| stats latest(Id) as Id by SystemModstamp is the solution. Those records showing up now are where my flag field is null. It's possible I'm hitting a race condition between Splunk and the ORM engine in Salesforce. The "life" of these records are basically:&lt;BR /&gt;&lt;BR /&gt;1. Written into me by an external system with no status / tag&lt;BR /&gt;2. Salesforce Flow picks up the record and immediately status tags it as "staged"&lt;BR /&gt;3. Some magic happens in another system internal to SFDC to process it.&lt;BR /&gt;4. Record is status tagged as "processed"&lt;/P&gt;&lt;P&gt;I'm now seeing some that Splunk must have picked up the second they hit me from the external system, before the Flow could put an initial status on them, because that field is null.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2023 18:35:49 GMT</pubDate>
    <dc:creator>arist0telis</dc:creator>
    <dc:date>2023-03-03T18:35:49Z</dc:date>
    <item>
      <title>Problems with dedup dropping too many records?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-dedup-dropping-too-many-records/m-p/633065#M219909</link>
      <description>I am having trouble with deduping on a Salesforce object and my "feels like" here is dedup isn't doing what I understand it to do. Short version of this is I have an object where records get updated by the system after insert. I only want the latest version of the record in my search. Since it's the system updating and not a user, LastModifiedDate doesn't get changed, only SystemModStamp, and sometimes only by a fraction of a second (but there is a noticeable difference in the SystemModStamp in search results where I have duplicated Ids). If I do | dedup Id it's not pulling the newest SystemModStamp, it's pulling the first one in the index. If I do | dedup Id,SystemModStamp I'm getting no records. Like, not just are we dropping the duplicate, we're dropping everything. I'm guessing that's because dedup by two fields isn't the composite key on a single record I thought it was? It's dropping any records with duplicated SystemModStamps? What I'm looking for is a composite key way to dedup on a single record by both Id and SystemModStamp.</description>
      <pubDate>Thu, 02 Mar 2023 22:04:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-dedup-dropping-too-many-records/m-p/633065#M219909</guid>
      <dc:creator>arist0telis</dc:creator>
      <dc:date>2023-03-02T22:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with dedup dropping too many records?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-dedup-dropping-too-many-records/m-p/633069#M219910</link>
      <description>&lt;P&gt;dedup on two fields will remove all events bar 1 that have the same combination of both fields, e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=1000
| fields - _time
| eval Id=random() % 3,SystemModStamp=random() % 3
| eventstats count by Id,SystemModStamp
| dedup Id, SystemModStamp
| sort Id, SystemModStamp
| addcoltotals count&lt;/LI-CODE&gt;&lt;P&gt;you will always get 9 events for the 1000 events.&lt;/P&gt;&lt;P&gt;However, in your data what does the _time field represent of those events?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Generally dedup can be done more predictably using stats with some kind of latest/max aggregation. if your event _time is the one you want then&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats latest(*) as * by Id&lt;/LI-CODE&gt;&lt;P&gt;may do the job.&lt;/P&gt;&lt;P&gt;dedup will simply record the first event it sees and remove subsequent duplicates, so it depends on event order, which unless you sort, may not be predictable.&lt;/P&gt;&lt;P&gt;Can you share some search to show what exactly you are trying to do and what data you want following the dedup&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 22:16:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-dedup-dropping-too-many-records/m-p/633069#M219910</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-03-02T22:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with dedup dropping too many records?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-dedup-dropping-too-many-records/m-p/633225#M219975</link>
      <description>&lt;P&gt;It's a custom object used for data staging for a secondary process, not sure what exactly to share. Even in a basic search this object, by its nature, is throwing duplicates in search.&lt;/P&gt;&lt;P&gt;Once the record is created in Salesforce, it sits in a "dirty" staging state before some behind the scenes code picks up the record, does some work through another system, and then updates a status field on the original staging record. I only want records that stay in the "dirty" staged state and never get updated, but Splunk manages to pick up the same record in both the "dirty" staged state and "clean" processed state and only the state and SystemModstamp are changed.&lt;/P&gt;&lt;P&gt;I tried changing the query and am still getting odd results so either that's not the ultimate fix or I'm still doing something wrong. The rest of my search predicates other tabling &amp;amp; stats off counts by Id so what I'm trying to do is "Give me all records where state = 'dirty' state and this is the latest version of that record by SystemModstamp."&lt;/P&gt;&lt;P&gt;I tried replacing my dedup Id with&amp;nbsp;| stats latest(Id) as Id by SystemModstamp. Looks like I'm not seeing my duplicated "dirty" records which is good but now I'm seeing other records I didn't expect to see. Still going through those.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 18:31:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-dedup-dropping-too-many-records/m-p/633225#M219975</guid>
      <dc:creator>arist0telis</dc:creator>
      <dc:date>2023-03-03T18:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with dedup dropping too many records?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-dedup-dropping-too-many-records/m-p/633226#M219976</link>
      <description>&lt;P&gt;Edit: Maybe this&amp;nbsp;| stats latest(Id) as Id by SystemModstamp is the solution. Those records showing up now are where my flag field is null. It's possible I'm hitting a race condition between Splunk and the ORM engine in Salesforce. The "life" of these records are basically:&lt;BR /&gt;&lt;BR /&gt;1. Written into me by an external system with no status / tag&lt;BR /&gt;2. Salesforce Flow picks up the record and immediately status tags it as "staged"&lt;BR /&gt;3. Some magic happens in another system internal to SFDC to process it.&lt;BR /&gt;4. Record is status tagged as "processed"&lt;/P&gt;&lt;P&gt;I'm now seeing some that Splunk must have picked up the second they hit me from the external system, before the Flow could put an initial status on them, because that field is null.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 18:35:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-dedup-dropping-too-many-records/m-p/633226#M219976</guid>
      <dc:creator>arist0telis</dc:creator>
      <dc:date>2023-03-03T18:35:49Z</dc:date>
    </item>
  </channel>
</rss>

