<?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 results with multiple fields &amp; multiple queries? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Distinct-results-with-multiple-fields-multiple-queries/m-p/484248#M135541</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;sourcetype="PCF:log" "/page1" OR "/page2" 
| rex field=msg "UserID: (?&amp;lt;UserID&amp;gt;\w+)" 
| rex field=msg "AccountNum: (?&amp;lt;AccountNum&amp;gt;\w+)" 
| streamstats window=1 count(eval(searchmatch("/page1"))) as page_one count(eval(searchmatch("/page2"))) as page_two
| where page_one &amp;gt; 0 AND page_two &amp;gt; 0
| table UserID, AccountNum
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 02 Mar 2020 20:04:17 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-03-02T20:04:17Z</dc:date>
    <item>
      <title>Distinct results with multiple fields &amp; multiple queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-results-with-multiple-fields-multiple-queries/m-p/484244#M135537</link>
      <description>&lt;P&gt;Hi all, I've been struggling with a good query for this for a few days.  Basically I'm trying to track users that drop off between pages in a guided web application.  &lt;/P&gt;

&lt;P&gt;I'm able to get the results for Page1 and for Page2 individually, but I don't know how to combine the two queries to get the desired result. I don't know if I need to work with join or distinct count.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8465iBF9B49F8B195F58E/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Basically on page1 I can dedup the AccoutNum, UserID  (I don't care if the same user comes through with the same account), but I do care if a different user does.  Users B and F both came to page one with account 567, but only F proceeded. &lt;/P&gt;

&lt;P&gt;I really want to learn so any guided help or explanation would be amazing.  Please let me know if anything is unclear.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 18:42:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-results-with-multiple-fields-multiple-queries/m-p/484244#M135537</guid>
      <dc:creator>mrhodes93</dc:creator>
      <dc:date>2020-02-28T18:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct results with multiple fields &amp; multiple queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-results-with-multiple-fields-multiple-queries/m-p/484245#M135538</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval Page_1="A,123#A,123#A,810#B,567#C,834#D,395#E,928#F,567"
| eval Page_1=split(Page_1,"#")
| mvexpand Page_1
| rex field=Page_1 "(?&amp;lt;UserID&amp;gt;\w),(?&amp;lt;AccountNum&amp;gt;\d+)"
| table UserID AccountNum
| eval source="Page1"
| append [|makeresults
| eval Page_2="A,123#D,395#F,567"
| eval Page_2=split(Page_2,"#")
| mvexpand Page_2
| rex field=Page_2 "(?&amp;lt;UserID&amp;gt;\w),(?&amp;lt;AccountNum&amp;gt;\d+)"
| table UserID AccountNum
| eval source="Page2"]
| stats values(A*) as A* dc(source) as flag by UserID AccountNum
| where flag = 1
| table UserID AccountNum
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What's your query?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 19:22:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-results-with-multiple-fields-multiple-queries/m-p/484245#M135538</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-28T19:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct results with multiple fields &amp; multiple queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-results-with-multiple-fields-multiple-queries/m-p/484246#M135539</link>
      <description>&lt;P&gt;Okay let me work with this.  I presented the question in a sample table but my query (for page 1) looks something like this:&lt;/P&gt;

&lt;P&gt;sourcetype="PCF:log" "/page1"  | rex field=msg "UserID: (?\w+)" | rex field=msg "AccountNum: (?\w+)" | dedup UserID, AccountNum | table UserID, AccountNum&lt;/P&gt;

&lt;P&gt;The only difference for page 2 would be the literal "/page2".   How would this information change what you've posted above? &lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 14:11:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-results-with-multiple-fields-multiple-queries/m-p/484246#M135539</guid>
      <dc:creator>mrhodes93</dc:creator>
      <dc:date>2020-03-02T14:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct results with multiple fields &amp; multiple queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-results-with-multiple-fields-multiple-queries/m-p/484247#M135540</link>
      <description>&lt;P&gt;I was able to get exactly what I needed by simply removing the the makesresults through the table commands replacing with my two queries noted.  I greatly appreciate the help @to4kawa! &lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 16:16:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-results-with-multiple-fields-multiple-queries/m-p/484247#M135540</guid>
      <dc:creator>mrhodes93</dc:creator>
      <dc:date>2020-03-02T16:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct results with multiple fields &amp; multiple queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-results-with-multiple-fields-multiple-queries/m-p/484248#M135541</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;sourcetype="PCF:log" "/page1" OR "/page2" 
| rex field=msg "UserID: (?&amp;lt;UserID&amp;gt;\w+)" 
| rex field=msg "AccountNum: (?&amp;lt;AccountNum&amp;gt;\w+)" 
| streamstats window=1 count(eval(searchmatch("/page1"))) as page_one count(eval(searchmatch("/page2"))) as page_two
| where page_one &amp;gt; 0 AND page_two &amp;gt; 0
| table UserID, AccountNum
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Mar 2020 20:04:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-results-with-multiple-fields-multiple-queries/m-p/484248#M135541</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-02T20:04:17Z</dc:date>
    </item>
  </channel>
</rss>

