<?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: Can you help me with a query involving the eval command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421797#M121146</link>
    <description>&lt;P&gt;yep, of course this always gets me &lt;CODE&gt;eval()&lt;/CODE&gt; requires in this case a &lt;CODE&gt;'&lt;/CODE&gt; instead of &lt;CODE&gt;"&lt;/CODE&gt; because using the &lt;CODE&gt;"&lt;/CODE&gt; will tell &lt;CODE&gt;eval()&lt;/CODE&gt; to compare two literal strings, not the values of two fields.&lt;/P&gt;

&lt;P&gt;So, &lt;BR /&gt;
using this &lt;CODE&gt;| where "Change by" = "Account Changed"&lt;/CODE&gt; will compare two strings&lt;BR /&gt;
using this &lt;CODE&gt;| where 'Change by' = 'Account Changed'&lt;/CODE&gt; will compare the values of two fields&lt;/P&gt;</description>
    <pubDate>Tue, 09 Oct 2018 23:55:01 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2018-10-09T23:55:01Z</dc:date>
    <item>
      <title>Can you help me with a query involving the eval command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421790#M121139</link>
      <description>&lt;P&gt;I'm trying to set up a search for when a user disables their 2FA vs when IT disables it for them. &lt;/P&gt;

&lt;P&gt;I have the User Account and the Actor account. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=auth sourcetype=auth mfa* (actor.displayName="*") legacyEventType="core.user.factor.deactivate" 
|stats count by "actor.displayName", "target{}.displayName", "displayMessage", _time
|rename "actor.displayName" AS "Changed by","target{}.displayName" AS "Account Changed", displayMessage as "Action"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results look like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Changed by  Account Changed      Action _time                 count
Bob Johnson Mike Smith  Reset factor for user   2018-10-09 15:16:19.880 1
Kelly Short Kelly Short Reset factor for user   2018-10-09 02:45:08.536 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm trying to compare if the "Changed by" and "Account Changed" matched, and return just those results. And then, eval if it doesn't like to compare values and match() asks to compare a field to a regex. &lt;/P&gt;

&lt;P&gt;Does anyone have any idea how to compare 2 field values from the same search? &lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 22:00:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421790#M121139</guid>
      <dc:creator>ColinJacksonPS</dc:creator>
      <dc:date>2018-10-09T22:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with a query involving the eval command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421791#M121140</link>
      <description>&lt;P&gt;Hi ColinJacksonPS,&lt;/P&gt;

&lt;P&gt;give this a try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=auth sourcetype=auth mfa* (actor.displayName="*") legacyEventType="core.user.factor.deactivate" 
 | stats count by "actor.displayName", "target{}.displayName", "displayMessage", _time
 | rename "actor.displayName" AS "Changed by","target{}.displayName" AS "Account Changed", displayMessage as "Action"
 | where 'Change by' = 'Account Changed'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will compare the values of both fields and only show the ones that are same.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 22:21:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421791#M121140</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-10-09T22:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with a query involving the eval command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421792#M121141</link>
      <description>&lt;P&gt;No, doesn't work. I changed it to "Change*&lt;EM&gt;d&lt;/EM&gt;* by" and the result is still blank. Finds the 3 events in Events tab, but not the Statistics tab. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:35:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421792#M121141</guid>
      <dc:creator>ColinJacksonPS</dc:creator>
      <dc:date>2020-09-29T21:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with a query involving the eval command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421793#M121142</link>
      <description>&lt;P&gt;Also tried |where.... ==...., but I don't think that works with the where command&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 22:27:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421793#M121142</guid>
      <dc:creator>ColinJacksonPS</dc:creator>
      <dc:date>2018-10-09T22:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with a query involving the eval command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421794#M121143</link>
      <description>&lt;P&gt;@ColinJacksonPS,&lt;/P&gt;

&lt;P&gt;Try renaming the fields with space , compare and change it back&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=auth sourcetype=auth mfa* (actor.displayName="*") legacyEventType="core.user.factor.deactivate" 
 |stats count by "actor.displayName", "target{}.displayName", "displayMessage", _time
 |rename "actor.displayName" AS "Changed","target{}.displayName" AS "Account", displayMessage as "Action"
 |where Changed==Account
 |rename Changed as "Changed by",Account as "Account Changed"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR evaluate to a variable &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=auth sourcetype=auth mfa* (actor.displayName="*") legacyEventType="core.user.factor.deactivate" 
 |stats count by "actor.displayName", "target{}.displayName", "displayMessage", _time
 |rename "actor.displayName" AS "Changed","target{}.displayName" AS "Account", displayMessage as "Action"
 |eval isEqual=if(Changed==Account,"yes","no")
 |rename Changed as "Changed by",Account as "Account Changed"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Oct 2018 22:29:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421794#M121143</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-10-09T22:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with a query involving the eval command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421795#M121144</link>
      <description>&lt;P&gt;try it without rename and the original field name in the &lt;CODE&gt;where&lt;/CODE&gt;  &lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 22:30:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421795#M121144</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-10-09T22:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with a query involving the eval command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421796#M121145</link>
      <description>&lt;P&gt;I think where needs single quotes for field names which have non-alphanumerics.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 22:31:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421796#M121145</guid>
      <dc:creator>chanfoli</dc:creator>
      <dc:date>2018-10-09T22:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with a query involving the eval command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421797#M121146</link>
      <description>&lt;P&gt;yep, of course this always gets me &lt;CODE&gt;eval()&lt;/CODE&gt; requires in this case a &lt;CODE&gt;'&lt;/CODE&gt; instead of &lt;CODE&gt;"&lt;/CODE&gt; because using the &lt;CODE&gt;"&lt;/CODE&gt; will tell &lt;CODE&gt;eval()&lt;/CODE&gt; to compare two literal strings, not the values of two fields.&lt;/P&gt;

&lt;P&gt;So, &lt;BR /&gt;
using this &lt;CODE&gt;| where "Change by" = "Account Changed"&lt;/CODE&gt; will compare two strings&lt;BR /&gt;
using this &lt;CODE&gt;| where 'Change by' = 'Account Changed'&lt;/CODE&gt; will compare the values of two fields&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 23:55:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421797#M121146</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-10-09T23:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with a query involving the eval command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421798#M121147</link>
      <description>&lt;P&gt;This did it. Single quotes FTW&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=auth sourcetype=auth mfa* (actor.displayName="*") legacyEventType="core.user.factor.deactivate" 
     | stats count by "actor.displayName", "target{}.displayName", "displayMessage", _time
      | rename "actor.displayName" AS "Changed by","target{}.displayName" AS "Account Changed", displayMessage as "Action"
      | where 'Changed by' = 'Account Changed'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks @MuS @chanfoli &lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 14:54:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-a-query-involving-the-eval-command/m-p/421798#M121147</guid>
      <dc:creator>ColinJacksonPS</dc:creator>
      <dc:date>2018-10-10T14:54:22Z</dc:date>
    </item>
  </channel>
</rss>

