<?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: Is it possible to compare equality of two fields at the root search without using | search, | where, or | eval? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399836#M167424</link>
    <description>&lt;P&gt;See if you can manage that with a &lt;CODE&gt;tstats&lt;/CODE&gt; command.  &lt;/P&gt;

&lt;P&gt;Something like...  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | tstats max(_time) where index=foo sourcetype=qualys by dest
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I doubt if &lt;CODE&gt;dest&lt;/CODE&gt; is an index time field, so it might not be available to &lt;CODE&gt;tstats&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;If not, then if you just want the most recent _time, then try &lt;CODE&gt;dedup&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=foo sourcetype=qualys earliest=-30d@d | dedup dest  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;With regard to your underlying question, &lt;/P&gt;

&lt;P&gt;1) &lt;CODE&gt;search&lt;/CODE&gt; treats the right side of an &lt;CODE&gt;=&lt;/CODE&gt; as a literal, whereas &lt;CODE&gt;where&lt;/CODE&gt; evaluates both sides.  &lt;/P&gt;

&lt;P&gt;2)  There is no way to compare two fields before the first pipe.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Sep 2018 01:55:15 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2018-09-27T01:55:15Z</dc:date>
    <item>
      <title>Is it possible to compare equality of two fields at the root search without using | search, | where, or | eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399831#M167419</link>
      <description>&lt;P&gt;I'm trying to work around the limitations of data model root searches not supporting pipes.&lt;/P&gt;

&lt;P&gt;Is there any way to do see if fieldX=fieldY at the root search level or does Splunk always treat the "fieldY" as a string?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 21:08:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399831#M167419</guid>
      <dc:creator>responsys_cm</dc:creator>
      <dc:date>2018-09-25T21:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to compare equality of two fields at the root search without using | search, | where, or | eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399832#M167420</link>
      <description>&lt;P&gt;Data models can be interacted with in multiple ways. Can you provide the search that you're working on? Also, is the data model accelerated?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 22:09:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399832#M167420</guid>
      <dc:creator>zonistj</dc:creator>
      <dc:date>2018-09-25T22:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to compare equality of two fields at the root search without using | search, | where, or | eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399833#M167421</link>
      <description>&lt;P&gt;The search needs to use something like eventstats to find the most recent timestamp for the events, in this case the last time a destination IP was scanned by a vulnerability scanner.  But searches with pipes aren't supported by data models.&lt;/P&gt;

&lt;P&gt;So, I could put the most recent scan time for each IP in a lookup table and create an automatic lookup for it.  That way I could have a top level search that says _time=last_scan_time if I can get the last_scan_time to be treated as a field like with WHERE rather than a string...&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:26:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399833#M167421</guid>
      <dc:creator>responsys_cm</dc:creator>
      <dc:date>2020-09-29T21:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to compare equality of two fields at the root search without using | search, | where, or | eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399834#M167422</link>
      <description>&lt;P&gt;I'd like to help you, but I need more information. There are ways to search data models using pipes.&lt;/P&gt;

&lt;P&gt;For example, we can use tstats to search the authentication data model and use trailing pipe commands:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats `summariesonly` values(Authentication.app) AS app count from datamodel=Authentication.Authentication WHERE Authentication.user!="unknown" by Authentication.action,Authentication.user 
| `drop_dm_object_name("Authentication")`
| eval success=if(action="success",count,0),failure=if(action="failure",count,0)
| stats values(app) as app,sum(failure) as failure,sum(success) as success by user
| where success &amp;gt; 0
| xswhere failure from failures_by_src_count_1d in authentication is above medium
| sort - failure
| eval failure = tostring('failure',"commas"), success = tostring('success',"commas")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We can also use the "|from datamodel" syntax:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| from datamodel:"Authentication"."Authentication" 
| search user="malicious_user" errorCode="AccessDenied" 
| stats count by app
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can you provide some additional info about what data model you're working with, and maybe a sample of the search you have so far?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 23:29:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399834#M167422</guid>
      <dc:creator>zonistj</dc:creator>
      <dc:date>2018-09-25T23:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to compare equality of two fields at the root search without using | search, | where, or | eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399835#M167423</link>
      <description>&lt;P&gt;I'm not trying to search the data model, I am trying to feed data into it.  I want to run something like this:&lt;/P&gt;

&lt;P&gt;sourcetype=qualys earliest=-30d@d | eventstats max(_time) AS last_scan by dest | where _time=last_scan&lt;/P&gt;

&lt;P&gt;That will give me the most recent scan of all hosts over the last 30 days.  I want that in a data model since tscollect and namespaces aren't supported on search head clusters.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:26:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399835#M167423</guid>
      <dc:creator>responsys_cm</dc:creator>
      <dc:date>2020-09-29T21:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to compare equality of two fields at the root search without using | search, | where, or | eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399836#M167424</link>
      <description>&lt;P&gt;See if you can manage that with a &lt;CODE&gt;tstats&lt;/CODE&gt; command.  &lt;/P&gt;

&lt;P&gt;Something like...  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | tstats max(_time) where index=foo sourcetype=qualys by dest
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I doubt if &lt;CODE&gt;dest&lt;/CODE&gt; is an index time field, so it might not be available to &lt;CODE&gt;tstats&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;If not, then if you just want the most recent _time, then try &lt;CODE&gt;dedup&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=foo sourcetype=qualys earliest=-30d@d | dedup dest  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;With regard to your underlying question, &lt;/P&gt;

&lt;P&gt;1) &lt;CODE&gt;search&lt;/CODE&gt; treats the right side of an &lt;CODE&gt;=&lt;/CODE&gt; as a literal, whereas &lt;CODE&gt;where&lt;/CODE&gt; evaluates both sides.  &lt;/P&gt;

&lt;P&gt;2)  There is no way to compare two fields before the first pipe.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 01:55:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399836#M167424</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-09-27T01:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to compare equality of two fields at the root search without using | search, | where, or | eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399837#M167425</link>
      <description>&lt;P&gt;I understand now. Thank you for the clarification.&lt;/P&gt;

&lt;P&gt;I think your best bet is to feed events into the data model and then create a separate search or report that pulls out the latest scan events. I'll try a few things to see if I can get it to work and let you know.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2018 15:58:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-compare-equality-of-two-fields-at-the-root/m-p/399837#M167425</guid>
      <dc:creator>zonistj</dc:creator>
      <dc:date>2018-09-27T15:58:26Z</dc:date>
    </item>
  </channel>
</rss>

