<?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: LIKE and like() in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/LIKE-and-like/m-p/464569#M6892</link>
    <description>&lt;P&gt;As per &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/ConditionalFunctions#like.28TEXT.2C_PATTERN.29"&gt;Splunk Docs&lt;/A&gt;, below syntax seems preferred.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; .. | where like (foo, "bar")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 20 Jan 2020 06:18:37 GMT</pubDate>
    <dc:creator>jawaharas</dc:creator>
    <dc:date>2020-01-20T06:18:37Z</dc:date>
    <item>
      <title>LIKE and like()</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/LIKE-and-like/m-p/464568#M6891</link>
      <description>&lt;P&gt;Just want to clear this up so I am not mistaken. Are the two statements equivalent:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | where like (foo, "bar")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where foo LIKE "bar"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In my test setup I am getting the same search results, I'm wondering if there is anything different on the backend that Splunk does. From the Job inspector it seems they both run the same Optimized search of the first option. Should this be the preferred syntax?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 10:11:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/LIKE-and-like/m-p/464568#M6891</guid>
      <dc:creator>ak1508</dc:creator>
      <dc:date>2019-12-11T10:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: LIKE and like()</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/LIKE-and-like/m-p/464569#M6892</link>
      <description>&lt;P&gt;As per &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/ConditionalFunctions#like.28TEXT.2C_PATTERN.29"&gt;Splunk Docs&lt;/A&gt;, below syntax seems preferred.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; .. | where like (foo, "bar")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jan 2020 06:18:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/LIKE-and-like/m-p/464569#M6892</guid>
      <dc:creator>jawaharas</dc:creator>
      <dc:date>2020-01-20T06:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: LIKE and like()</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/LIKE-and-like/m-p/464570#M6893</link>
      <description>&lt;P&gt;@ak1508  as per color coding for SPL post &lt;CODE&gt;Splunk 6.5&lt;/CODE&gt;,     the &lt;CODE&gt;like&lt;/CODE&gt; in the command &lt;CODE&gt;| where foo like "bar"&lt;/CODE&gt; is an argument as it highlights as orange, but using &lt;CODE&gt;| where like(foo,"bar")&lt;/CODE&gt; treats it as function and highlights as pink. Refer to Splunk Documentation for the same: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Search/Parsingsearches#Color_codes"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Search/Parsingsearches#Color_codes&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;You should be using the second one because internally Splunk's Query Optimization converts the same to function&lt;/STRONG&gt; &lt;CODE&gt;like()&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Which implies following query in Splunk Search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval data="testabc"
| where data like "test%"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Converts to the following optimized query when it executes (you can check &lt;CODE&gt;Job Inspector&lt;/CODE&gt; for details:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults 
 | eval data="testabc" 
 | where like(data,"test%")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jan 2020 09:17:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/LIKE-and-like/m-p/464570#M6893</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-01-20T09:17:22Z</dc:date>
    </item>
  </channel>
</rss>

