<?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 to delete some duplicated events automatically? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-delete-some-duplicated-events-automatically/m-p/523713#M9381</link>
    <description>&lt;P&gt;Are you saying the events for a given "id" field have different "version" field values?&amp;nbsp; If so, then they are not really duplicate events.&lt;/P&gt;&lt;P&gt;If you still want to get rid of them then there may be other ways to do so besides &lt;FONT face="courier new,courier"&gt;| delete&lt;/FONT&gt; (which doesn't actually delete anything).&lt;/P&gt;&lt;P&gt;If there is a way to use a regular expression to identify the duplicate events then using a transform to send the unwanted events to nullQueue is better because you are not using license quota for events that will never be seen.&lt;/P&gt;&lt;P&gt;Failing that, then using delete may be the final option.&amp;nbsp; Create a scheduled search that runs every few minutes, looks at the previous few minutes for duplicates, and deletes them.&amp;nbsp; The schedule search must be owned by a user that has the "can_delete" role.&amp;nbsp; Do NOT use this user for any other activity or you risk other data being deleted.&amp;nbsp; CAUTION: Here There Be Dragons.&amp;nbsp; I doubt an auditor will approve of this procedure so use it only if you are not subject to audits.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Oct 2020 14:37:58 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-10-08T14:37:58Z</dc:date>
    <item>
      <title>How to delete some duplicated events automatically?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-delete-some-duplicated-events-automatically/m-p/523514#M9380</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I need to delete duplicated events, since one of my data sources sends duplicated events, there is a field "id" and also a field "version" so I can identify the last one in order to keep it and delete the others. I need this process to run automatically every hour for example. Any suggestions?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 19:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-delete-some-duplicated-events-automatically/m-p/523514#M9380</guid>
      <dc:creator>jmcr</dc:creator>
      <dc:date>2020-10-07T19:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete some duplicated events automatically?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-delete-some-duplicated-events-automatically/m-p/523713#M9381</link>
      <description>&lt;P&gt;Are you saying the events for a given "id" field have different "version" field values?&amp;nbsp; If so, then they are not really duplicate events.&lt;/P&gt;&lt;P&gt;If you still want to get rid of them then there may be other ways to do so besides &lt;FONT face="courier new,courier"&gt;| delete&lt;/FONT&gt; (which doesn't actually delete anything).&lt;/P&gt;&lt;P&gt;If there is a way to use a regular expression to identify the duplicate events then using a transform to send the unwanted events to nullQueue is better because you are not using license quota for events that will never be seen.&lt;/P&gt;&lt;P&gt;Failing that, then using delete may be the final option.&amp;nbsp; Create a scheduled search that runs every few minutes, looks at the previous few minutes for duplicates, and deletes them.&amp;nbsp; The schedule search must be owned by a user that has the "can_delete" role.&amp;nbsp; Do NOT use this user for any other activity or you risk other data being deleted.&amp;nbsp; CAUTION: Here There Be Dragons.&amp;nbsp; I doubt an auditor will approve of this procedure so use it only if you are not subject to audits.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 14:37:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-delete-some-duplicated-events-automatically/m-p/523713#M9381</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-10-08T14:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete some duplicated events automatically?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-delete-some-duplicated-events-automatically/m-p/523717#M9382</link>
      <description>&lt;P&gt;I don't know if that would be wise.&amp;nbsp; It certainly might have unintended conseqences.&lt;/P&gt;&lt;P&gt;But, there are solutions.&lt;/P&gt;&lt;P&gt;Is there any way to fix the sending device to have it not do duplicates?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that's not possible, then to "delete" the others, you could do one of a few things.&lt;/P&gt;&lt;P&gt;You could set up a summary index, possibly, and send only ... no, because they'd still be duplicated - you'd have to clean out that summary index regularly.&amp;nbsp; Hmm.&lt;/P&gt;&lt;P&gt;You could build a lookup out of those, if they're not too big, and just overwrite it with only the 'best current values' every hour as a scheduled report doing an outputlookup at the end.&lt;/P&gt;&lt;P&gt;But, easiest, is probably just work around it in your SPL, perhaps a subsearch is easiest.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo sourcetype=bar 
    [ index=foo sourcetype=bar 
    | stats max(version) as version by id 
    | fields version id ]&lt;/LI-CODE&gt;&lt;P&gt;If you haven't dealt with subsearches before, ... well, they're pretty useful at times.&lt;/P&gt;&lt;P&gt;The subsearch is inside the [] brackets, and *it runs first*.&amp;nbsp; Once it completes, it returns its results back into the main search (formatted by default with () and AND and OR and whatnot).&amp;nbsp; Then it's part of the main search's search terms.&lt;/P&gt;&lt;P&gt;Like this example for my little firewall.&amp;nbsp; My APs run different versions of software (because I upgrade one of the two, and usually wait a few days before upgrading the other.).&amp;nbsp; If I wanted to only get records where the version was on the latest, I could do the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=fw 
    [ search index=fw 
    | stats max(host_version) as host_version by host 
    | fields host_version host ] &lt;/LI-CODE&gt;&lt;P&gt;The subsearch runs and ends up returning a list like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;( ( host="AP_Downstairs" AND host_version="v4.3.21.11325" ) OR ( host="AP_Upstairs" AND host_version="v4.3.21.11325" ) OR ( host="curie" ) )&lt;/LI-CODE&gt;&lt;P&gt;THAT search then gets appended right into the main search, so your full search resolves down to&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=fw ( ( host="AP_Downstairs" AND host_version="v4.3.21.11325" ) OR ( host="AP_Upstairs" AND host_version="v4.3.21.11325" ) OR ( host="curie" ) )&lt;/LI-CODE&gt;&lt;P&gt;If you ever need a different set of AND/OR/() or things grouped differently, there's a 'format' command you can use, it's a little obtuse but look at the examples. &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.6/SearchReference/Format" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.6/SearchReference/Format&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you search for Splunk subsearches, you'll find all sorts of help on them.&amp;nbsp; Here's a good set of starting points:&lt;/P&gt;&lt;P&gt;The search tutorial's examples: &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.6/SearchTutorial/Useasubsearch" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.6/SearchTutorial/Useasubsearch&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And about subsearches: &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.6/Search/Aboutsubsearches" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.6/Search/Aboutsubsearches&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;happy splunking!&lt;/P&gt;&lt;P&gt;-Rich&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 14:41:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-delete-some-duplicated-events-automatically/m-p/523717#M9382</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2020-10-08T14:41:40Z</dc:date>
    </item>
  </channel>
</rss>

