<?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 Need to dedup results based on id only if the field is not empty in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-to-dedup-results-based-on-id-only-if-the-field-is-not-empty/m-p/113549#M29894</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I need help deduplicating in a search where only half the data contains an id. Basically, the old data has a field &lt;CODE&gt;ses_id : ""&lt;/CODE&gt; whilst the new data will be populated &lt;CODE&gt;ses_id : "123"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The search ends up with a table where we need a count which only deduplicates the entries which have a number in the ses_id field. A normal dedup is not good enough as it will count all the entries with "" as a single one obviously.&lt;/P&gt;

&lt;P&gt;My search is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="testindex" app="testapp" action="view" | stats count as views, max(_time) as _time by name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help would be appreciated,&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 24 Oct 2013 14:31:57 GMT</pubDate>
    <dc:creator>anthonycopus</dc:creator>
    <dc:date>2013-10-24T14:31:57Z</dc:date>
    <item>
      <title>Need to dedup results based on id only if the field is not empty</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-dedup-results-based-on-id-only-if-the-field-is-not-empty/m-p/113549#M29894</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I need help deduplicating in a search where only half the data contains an id. Basically, the old data has a field &lt;CODE&gt;ses_id : ""&lt;/CODE&gt; whilst the new data will be populated &lt;CODE&gt;ses_id : "123"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The search ends up with a table where we need a count which only deduplicates the entries which have a number in the ses_id field. A normal dedup is not good enough as it will count all the entries with "" as a single one obviously.&lt;/P&gt;

&lt;P&gt;My search is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="testindex" app="testapp" action="view" | stats count as views, max(_time) as _time by name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help would be appreciated,&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2013 14:31:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-dedup-results-based-on-id-only-if-the-field-is-not-empty/m-p/113549#M29894</guid>
      <dc:creator>anthonycopus</dc:creator>
      <dc:date>2013-10-24T14:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need to dedup results based on id only if the field is not empty</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-dedup-results-based-on-id-only-if-the-field-is-not-empty/m-p/113550#M29895</link>
      <description>&lt;P&gt;You could try to search for ses_id is not null, dedup the results, and then join a second search that finds those ses_id that are null.&lt;BR /&gt;&lt;BR /&gt;
There is not enough info to tell you what field to join on.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:03:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-dedup-results-based-on-id-only-if-the-field-is-not-empty/m-p/113550#M29895</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2020-09-28T15:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need to dedup results based on id only if the field is not empty</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-dedup-results-based-on-id-only-if-the-field-is-not-empty/m-p/113551#M29896</link>
      <description>&lt;P&gt;Thanks, in the end I found a cleaner alternative:&lt;/P&gt;

&lt;P&gt;| eval ses_id=nullif(ses_id,"") | dedup ses_id keepempty=true&lt;/P&gt;

&lt;P&gt;Changing the "" in the field to null meant I could use the keepempty function in the search&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:03:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-dedup-results-based-on-id-only-if-the-field-is-not-empty/m-p/113551#M29896</guid>
      <dc:creator>anthonycopus</dc:creator>
      <dc:date>2020-09-28T15:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need to dedup results based on id only if the field is not empty</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-dedup-results-based-on-id-only-if-the-field-is-not-empty/m-p/113552#M29897</link>
      <description>&lt;P&gt;Found an easy fix by changing the field populated with "" to null using the following search in total:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="testindex" app="testapp" action="view" | eval ses_id=nullif(ses_id,"") | dedup ses_id keepempty=true | stats count as views, max(_time) as _time by name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Changing the field to null is there was no entry meant the keepempty property in the dedup can be used successfully&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2013 15:32:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-dedup-results-based-on-id-only-if-the-field-is-not-empty/m-p/113552#M29897</guid>
      <dc:creator>anthonycopus</dc:creator>
      <dc:date>2013-10-24T15:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need to dedup results based on id only if the field is not empty</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-dedup-results-based-on-id-only-if-the-field-is-not-empty/m-p/113553#M29898</link>
      <description>&lt;P&gt;tl;dr keepempty=true&lt;/P&gt;

&lt;P&gt;I have no idea how I have used Splunk for this long and not known about this. Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 19:24:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-dedup-results-based-on-id-only-if-the-field-is-not-empty/m-p/113553#M29898</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2019-03-14T19:24:00Z</dc:date>
    </item>
  </channel>
</rss>

