<?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: Get a distinct count of field values matching a regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-a-distinct-count-of-field-values-matching-a-regex/m-p/308313#M92498</link>
    <description>&lt;P&gt;Try this,&lt;/P&gt;

&lt;P&gt;i have used your regex only below query&lt;/P&gt;

&lt;P&gt;your base query |  search $country$ $campaign_name$ event_name=email OR event_name=event | regex max_match=0 person_id="^(?P(.?$|[^W].+|W[^F].*))" | stats dc(test_person_id) as persion_id .&lt;/P&gt;

&lt;P&gt;Still if it not fetching result. please post some sample events.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 14:57:50 GMT</pubDate>
    <dc:creator>sbbadri</dc:creator>
    <dc:date>2020-09-29T14:57:50Z</dc:date>
    <item>
      <title>Get a distinct count of field values matching a regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-a-distinct-count-of-field-values-matching-a-regex/m-p/308310#M92495</link>
      <description>&lt;P&gt;I am doing this -&lt;BR /&gt;
&amp;lt;&amp;lt;&amp;gt;&amp;gt; | search $country$ $campaign_name$ event_name=email OR event_name=event|stats dc(person_id)&lt;/P&gt;

&lt;P&gt;Now in last instead of dc of person_id i need a count of person_id which matches a regex -&lt;BR /&gt;
&amp;lt;&amp;lt;&amp;gt;&amp;gt; | search $country$ $campaign_name$ event_name=email OR event_name=event|stats dc(regex person_id="^(.?$|[^W].+|W[^F].*)" )&lt;/P&gt;

&lt;P&gt;I tried above query using regex in dc() but it breaks. Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:53:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-a-distinct-count-of-field-values-matching-a-regex/m-p/308310#M92495</guid>
      <dc:creator>gdagur</dc:creator>
      <dc:date>2020-09-29T14:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Get a distinct count of field values matching a regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-a-distinct-count-of-field-values-matching-a-regex/m-p/308311#M92496</link>
      <description>&lt;P&gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt; | search $country$ $campaign_name$ event_name=email OR event_name=event | regex person_id="^(?P&amp;lt;test_person_id&amp;gt;(.?$|[^W].+|W[^F].*))"  | stats dc(test_person_id) as persion_id&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:55:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-a-distinct-count-of-field-values-matching-a-regex/m-p/308311#M92496</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T14:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Get a distinct count of field values matching a regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-a-distinct-count-of-field-values-matching-a-regex/m-p/308312#M92497</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/55793"&gt;@sbbadri&lt;/a&gt; - Regex which I am using "Regex person_id="^(.?$|[^W].+|W[^F].*)", it is to find person_ids which are not starting with 'WF'. Regex is correct, I validated that. Query which you have given above fetching 0 results even though I have multiple person_id present in logs. They are in the form of - person_id="9e9f0ec6-899e-43a8-b1e3-ca158516b6fe".&lt;BR /&gt;
Any advice what could be going wrong.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:57:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-a-distinct-count-of-field-values-matching-a-regex/m-p/308312#M92497</guid>
      <dc:creator>gdagur</dc:creator>
      <dc:date>2020-09-29T14:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Get a distinct count of field values matching a regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-a-distinct-count-of-field-values-matching-a-regex/m-p/308313#M92498</link>
      <description>&lt;P&gt;Try this,&lt;/P&gt;

&lt;P&gt;i have used your regex only below query&lt;/P&gt;

&lt;P&gt;your base query |  search $country$ $campaign_name$ event_name=email OR event_name=event | regex max_match=0 person_id="^(?P(.?$|[^W].+|W[^F].*))" | stats dc(test_person_id) as persion_id .&lt;/P&gt;

&lt;P&gt;Still if it not fetching result. please post some sample events.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-a-distinct-count-of-field-values-matching-a-regex/m-p/308313#M92498</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T14:57:50Z</dc:date>
    </item>
  </channel>
</rss>

