<?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: Distinct counts on only those fields that begin with a particular string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Distinct-counts-on-only-those-fields-that-begin-with-a/m-p/571422#M199123</link>
    <description>&lt;P&gt;Hi KV&lt;/P&gt;&lt;P&gt;Thanks for this. It's wasn't quite what I needed but got me on the right path to working it out. This is how I changed it and it appears to be working how I need with my original data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=searchdata domain="*edublogs*"&lt;BR /&gt;| eval distinctCenters=Case(Like(domain,"edublogs%"), centre)&lt;BR /&gt;| eval distinctUserids=Case(Like(domain,"edublogs%"), userid)&lt;BR /&gt;| eventstats dc(distinctCenters) as distinctCenters, dc(distinctUserids) as distinctUserids by domain&lt;BR /&gt;| stats count, sum(bytes) AS totalBytes by domain, distinctCenters, distinctUserids&lt;BR /&gt;| table domain totalBytes, distinctCenters, distinctUserids&lt;/P&gt;&lt;P&gt;deton0&lt;/P&gt;</description>
    <pubDate>Mon, 18 Oct 2021 22:01:01 GMT</pubDate>
    <dc:creator>deton0</dc:creator>
    <dc:date>2021-10-18T22:01:01Z</dc:date>
    <item>
      <title>Distinct counts on only those fields that begin with a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-counts-on-only-those-fields-that-begin-with-a/m-p/571253#M199055</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I'm searching on an internet usage index for events that contain a particular word somewhere in the domain. For example the word could be "edublogs".&lt;/P&gt;&lt;P&gt;From the result, I need to sum the total of bytes downloaded for all events returned. The problem I'm having is needing to calculate a distinct count of centers and a distinct count of userids where the domain name only begins with "edublogs", e.g. "edublogs.com" and not when it doesn't, e.g.&amp;nbsp; "accountsedublogs.com".&lt;/P&gt;&lt;P&gt;I know this example is wrong but can someone please help me with how I would change it to achieve the outcome below?&lt;/P&gt;&lt;P&gt;index=searchdata domain="*edublogs*"&lt;BR /&gt;| stats count dc(centre) AS distinctCenters&lt;BR /&gt;| stats count dc(userid) AS distinctUserids&lt;BR /&gt;&lt;SPAN&gt;| stats sum(bytes) AS totalBytes by domain&lt;BR /&gt;&lt;/SPAN&gt;| table domain totalBytes, distinctCenters, distinctUserids&lt;/P&gt;&lt;P&gt;My desired results would look something like...&lt;BR /&gt;domain totalBytes distinctCenters distinctUserids&lt;BR /&gt;Senior 50000 15 321&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 03:59:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-counts-on-only-those-fields-that-begin-with-a/m-p/571253#M199055</guid>
      <dc:creator>deton0</dc:creator>
      <dc:date>2021-10-18T03:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct counts on only those fields that begin with a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-counts-on-only-those-fields-that-begin-with-a/m-p/571261#M199057</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/37814"&gt;@deton0&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=searchdata domain="*edublogs*"
| stats count dc(centre) AS distinctCenters, dc(userid) AS distinctUserids, sum(bytes) AS totalBytes by domain
| table domain totalBytes, distinctCenters, distinctUserids&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;KV&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 05:21:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-counts-on-only-those-fields-that-begin-with-a/m-p/571261#M199057</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-10-18T05:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct counts on only those fields that begin with a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-counts-on-only-those-fields-that-begin-with-a/m-p/571422#M199123</link>
      <description>&lt;P&gt;Hi KV&lt;/P&gt;&lt;P&gt;Thanks for this. It's wasn't quite what I needed but got me on the right path to working it out. This is how I changed it and it appears to be working how I need with my original data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=searchdata domain="*edublogs*"&lt;BR /&gt;| eval distinctCenters=Case(Like(domain,"edublogs%"), centre)&lt;BR /&gt;| eval distinctUserids=Case(Like(domain,"edublogs%"), userid)&lt;BR /&gt;| eventstats dc(distinctCenters) as distinctCenters, dc(distinctUserids) as distinctUserids by domain&lt;BR /&gt;| stats count, sum(bytes) AS totalBytes by domain, distinctCenters, distinctUserids&lt;BR /&gt;| table domain totalBytes, distinctCenters, distinctUserids&lt;/P&gt;&lt;P&gt;deton0&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 22:01:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-counts-on-only-those-fields-that-begin-with-a/m-p/571422#M199123</guid>
      <dc:creator>deton0</dc:creator>
      <dc:date>2021-10-18T22:01:01Z</dc:date>
    </item>
  </channel>
</rss>

