<?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: Different element between two stats values() lists in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463355#M130617</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;| where eventcount=3 AND usr=usr_mod
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This query selects &lt;EM&gt;user&lt;/EM&gt; and &lt;EM&gt;user_mod&lt;/EM&gt; both have same value.&lt;BR /&gt;
Hence, &lt;CODE&gt;| stats values(user) as AllUsers, values(usr_mod) as ModifiedUsers&lt;/CODE&gt; result is same values.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 04:08:19 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-09-30T04:08:19Z</dc:date>
    <item>
      <title>Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463348#M130610</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;search made before ...| stats values(user) as AllUsers, values(usr_mod) as ModifiedUsers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And it returns two lists&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Usr1            Usr4
Usr3            Usr2
Usr2            Usr1
Usr4            
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My purpose is to get the users that weren't modified i.e:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; Usr3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advanced,&lt;BR /&gt;
Rsaude&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 17:51:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463348#M130610</guid>
      <dc:creator>rsaude</dc:creator>
      <dc:date>2020-02-06T17:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463349#M130611</link>
      <description>&lt;P&gt;Give this a try:&lt;/P&gt;

&lt;P&gt;| where user!="" AND usr_mod==""&lt;BR /&gt;
| stats list&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 18:44:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463349#M130611</guid>
      <dc:creator>13tsavage</dc:creator>
      <dc:date>2020-02-06T18:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463350#M130612</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="AllUsers ModifiedUsers
Usr1            Usr4
Usr3            Usr2
Usr2            Usr1
Usr4"
| multikv forceheader=1
| stats values(*) as *
| table AllUsers ModifiedUsers
`comment("this is your result sample. from here, the logic")`
| stats values(*) as * by AllUsers
| eval check=if(match(ModifiedUsers,AllUsers),1,0)
| stats values(eval(if(check=0,AllUsers,NULL))) as AllUsers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;stats&lt;/CODE&gt; and &lt;CODE&gt;stats&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 03:33:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463350#M130612</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-07T03:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463351#M130613</link>
      <description>&lt;P&gt;I couldn't get this code to work with only the logic or with the full code...&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 10:00:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463351#M130613</guid>
      <dc:creator>rsaude</dc:creator>
      <dc:date>2020-02-07T10:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463352#M130614</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="my answer"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8335i8BDC8CBEF82DD242/image-size/large?v=v2&amp;amp;px=999" role="button" title="my answer" alt="my answer" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults 
 | eval _raw="AllUsers,ModifiedUsers
 admin,splunk
 splunk,tenable.admin
 tenable.admin,"
 | multikv forceheader=1
 | stats values(*) as *
 | table AllUsers ModifiedUsers
 `comment("this is your result sample. from here, the logic")`
 | stats values(*) as * by AllUsers
 | eval check = if(match(ModifiedUsers,"^".AllUsers."$"),1,0)
 | stats values(eval(if(check=0,AllUsers,NULL))) as AllUsers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Recommend:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tenable (module=auth message="*login*") OR (module=user (message="*modefied*password*" OR message="*created user*))
| rex field=message "\[(?'usr'.*?)\].*\[(?'usr_mod'.*?)\]
| transaction startswith="created user" endswith="*modified*password*"
| where eventcount=3 usr=usr_mod
| stats values(user) as AllUsers, values(usr_mod) as ModifiedUsers 
| stats values(*) as * by AllUsers
| eval check = if(match(ModifiedUsers,"^".AllUsers."$"),1,0)
| stats values(eval(if(check=0,AllUsers,NULL))) as AllUsers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;&amp;gt;I couldn't get this code to work with only the logic or with the full code...&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;@rsaude&lt;BR /&gt;&lt;BR /&gt;
OK, REGEX  was wrong. I've fixed it.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 10:35:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463352#M130614</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-07T10:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463353#M130615</link>
      <description>&lt;P&gt;My bad, i got it to work with the full makeresult but i cant work it with my own, i'm gonna edit the original post and post the full query, there might be something wrong with the original query&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 10:50:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463353#M130615</guid>
      <dc:creator>rsaude</dc:creator>
      <dc:date>2020-02-07T10:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463354#M130616</link>
      <description>&lt;P&gt;i can't seem to change the question so i'll post it on the comments:&lt;/P&gt;

&lt;P&gt;Here is the full query:&lt;BR /&gt;
    index=xxx (module=auth message="&lt;EM&gt;login&lt;/EM&gt;") OR (module=user (message="&lt;EM&gt;modified*password&lt;/EM&gt;" OR message="&lt;EM&gt;created user&lt;/EM&gt;")) &lt;BR /&gt;
    | rex field=message "[(?'usr'.&lt;EM&gt;?)].&lt;/EM&gt;[(?'usr_mod'.&lt;EM&gt;?)]" &lt;BR /&gt;
    | transaction startswith="created user" endswith="*modified*password&lt;/EM&gt;" &lt;BR /&gt;
    | where eventcount=3 AND usr=usr_mod &lt;BR /&gt;
    | stats values(user) as AllUsers, values(usr_mod) as ModifiedUsers&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:08:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463354#M130616</guid>
      <dc:creator>rsaude</dc:creator>
      <dc:date>2020-09-30T04:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463355#M130617</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| where eventcount=3 AND usr=usr_mod
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This query selects &lt;EM&gt;user&lt;/EM&gt; and &lt;EM&gt;user_mod&lt;/EM&gt; both have same value.&lt;BR /&gt;
Hence, &lt;CODE&gt;| stats values(user) as AllUsers, values(usr_mod) as ModifiedUsers&lt;/CODE&gt; result is same values.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:08:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463355#M130617</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-09-30T04:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463356#M130618</link>
      <description>&lt;P&gt;there are 3 fields, user, usr and usr_mod, they do not have the same values&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 11:16:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463356#M130618</guid>
      <dc:creator>rsaude</dc:creator>
      <dc:date>2020-02-07T11:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463357#M130619</link>
      <description>&lt;P&gt;my final purpose is to get the diference between all users that logged in and the users that changed their passwords on first login, just to check who didnt changed it on the first login.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 11:19:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463357#M130619</guid>
      <dc:creator>rsaude</dc:creator>
      <dc:date>2020-02-07T11:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463358#M130620</link>
      <description>&lt;P&gt;I see , sorry. I have a mistake.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| stats values(user) as AllUsers, values(usr_mod) as ModifiedUsers&lt;/CODE&gt;&lt;BR /&gt;
what's this &lt;STRONG&gt;real&lt;/STRONG&gt; results?&lt;/P&gt;

&lt;P&gt;I thought they had the same value, but they seemed different.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 11:24:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463358#M130620</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-07T11:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463359#M130621</link>
      <description>&lt;P&gt;&lt;A href="https://imgur.com/lv3cTnu"&gt;https://imgur.com/lv3cTnu&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 11:28:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463359#M130621</guid>
      <dc:creator>rsaude</dc:creator>
      <dc:date>2020-02-07T11:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463360#M130622</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=xxx (module=auth message="login") OR (module=user (message="modified*password" OR message="created user"))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;module: &lt;EM&gt;auth&lt;/EM&gt; and module: &lt;EM&gt;user&lt;/EM&gt; both have &lt;CODE&gt;user&lt;/CODE&gt; field?&lt;/P&gt;

&lt;P&gt;if the assumption is right,  the query is simple.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xxx (module=auth message="login") OR (module=user (message="modified*password" OR message="created user"))
| stats dc(message) as flag by user
| where flag!=3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Feb 2020 11:29:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463360#M130622</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-07T11:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463361#M130623</link>
      <description>&lt;P&gt;yes they both have it&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 11:32:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463361#M130623</guid>
      <dc:creator>rsaude</dc:creator>
      <dc:date>2020-02-07T11:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463362#M130624</link>
      <description>&lt;P&gt;that can't be the case, because i need to have exactly 3 events in this order, one that is the creation of the account, other that is login  and the last is the password reset. so i used transaction&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 11:42:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463362#M130624</guid>
      <dc:creator>rsaude</dc:creator>
      <dc:date>2020-02-07T11:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463363#M130625</link>
      <description>&lt;P&gt;@rsaude&lt;BR /&gt;
I find the problem and fixed it. please confirm my answer.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 12:02:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463363#M130625</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-07T12:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463364#M130626</link>
      <description>&lt;P&gt;@to4kawa  you had it praticly right, with a few erros, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tenable (module=auth message="*login*") OR (module=user (message="*modified*password*" OR message="*created user*"))
| rex field=message "\[(?'usr'.*?)\].*\[(?'usr_mod'.*?)\]"
| transaction startswith="created user" endswith="*modified*password*"
| where eventcount=3 AND usr=usr_mod
| stats values(user) as AllUsers, values(usr_mod) as ModifiedUsers | stats values(*) as * by AllUsers
 | eval check = if(match(ModifiedUsers,"^".AllUsers."$"),1,0)
 | stats values(eval(if(check=0,AllUsers,NULL))) as AllUsers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You had &lt;BR /&gt;
modefied and it was modified&lt;BR /&gt;
missing " at the end of the first and second line&lt;BR /&gt;
where is missing an AND between the conditions&lt;/P&gt;

&lt;P&gt;fix it so that i can call it an Correct awnser plss&lt;/P&gt;

&lt;P&gt;Btw tyy&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 13:33:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463364#M130626</guid>
      <dc:creator>rsaude</dc:creator>
      <dc:date>2020-02-07T13:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Different element between two stats values() lists</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463365#M130627</link>
      <description>&lt;P&gt;Corrected Code&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=tenable (module=auth message="*login*") OR (module=user (message="*modified*password*" OR message="*created user*"))
 | rex field=message "\[(?'usr'.*?)\].*\[(?'usr_mod'.*?)\]"
 | transaction startswith="created user" endswith="*modified*password*"
 | where eventcount=3 AND usr=usr_mod
 | stats values(user) as AllUsers, values(usr_mod) as ModifiedUsers | stats values(*) as * by AllUsers
  | eval check = if(match(ModifiedUsers,"^".AllUsers."$"),1,0)
  | stats values(eval(if(check=0,AllUsers,NULL))) as AllUsers
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Feb 2020 10:03:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-element-between-two-stats-values-lists/m-p/463365#M130627</guid>
      <dc:creator>rsaude</dc:creator>
      <dc:date>2020-02-10T10:03:22Z</dc:date>
    </item>
  </channel>
</rss>

