<?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 function overview? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304976#M166316</link>
    <description>&lt;P&gt;Hey @jassikul, Here's documentation on like: &lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/ConditionalFunctions"&gt;http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/ConditionalFunctions&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Aug 2017 18:48:55 GMT</pubDate>
    <dc:creator>lfedak_splunk</dc:creator>
    <dc:date>2017-08-29T18:48:55Z</dc:date>
    <item>
      <title>Like function overview?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304975#M166315</link>
      <description>&lt;P&gt;I am new to Splunk, Can someone please explain me what below query is doing and what does 1 mean at the end of Sourcetype and LIke and what 1=1. &lt;BR /&gt;
Thanks in advance&lt;/P&gt;

&lt;P&gt;| eval UseInSummary=case(&lt;BR /&gt;
                sourcetype="HTTP-RESULTS" AND Status="SUCCESS" AND Protocol="HTTP",1,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;              like(Type,"packet_%") AND ResultCalculated=1,1,
              like(Type,"seeder_%") AND ResultCalculated=1 AND Result&amp;lt;200,1,
              Type="latent" AND ResultCalculated=1 AND Result&amp;lt;1000,1,
              1=1,0
            )       
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Aug 2017 18:41:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304975#M166315</guid>
      <dc:creator>jassikul</dc:creator>
      <dc:date>2017-08-29T18:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Like function overview?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304976#M166316</link>
      <description>&lt;P&gt;Hey @jassikul, Here's documentation on like: &lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/ConditionalFunctions"&gt;http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/ConditionalFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2017 18:48:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304976#M166316</guid>
      <dc:creator>lfedak_splunk</dc:creator>
      <dc:date>2017-08-29T18:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Like function overview?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304977#M166317</link>
      <description>&lt;P&gt;Thanks Ifedak,&lt;/P&gt;

&lt;P&gt;Does 1 means, Its creating a new column and assigning value 1 to matching conditions or like conditions.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2017 19:03:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304977#M166317</guid>
      <dc:creator>jassikul</dc:creator>
      <dc:date>2017-08-29T19:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Like function overview?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304978#M166318</link>
      <description>&lt;P&gt;Figured out, it assigns value as 1 and 1=1, 0 Rest everything else is 0.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2017 19:07:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304978#M166318</guid>
      <dc:creator>jassikul</dc:creator>
      <dc:date>2017-08-29T19:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Like function overview?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304979#M166319</link>
      <description>&lt;P&gt;The &lt;CODE&gt;1==1&lt;/CODE&gt; is a simple way to generate a &lt;CODE&gt;boolean&lt;/CODE&gt; value of &lt;CODE&gt;true&lt;/CODE&gt;.  The fully proper way to do this is to use &lt;CODE&gt;true()&lt;/CODE&gt; which is much more clear.  The reason that it is there is because it is a best-practice use of &lt;CODE&gt;case&lt;/CODE&gt; to have a "catch-all" condition at the end, much like the &lt;CODE&gt;default&lt;/CODE&gt; condition does in most programming languages that have a &lt;CODE&gt;case&lt;/CODE&gt; command.   The &lt;CODE&gt;like&lt;/CODE&gt; command uses &lt;CODE&gt;SQL&lt;/CODE&gt; syntax to generate a &lt;CODE&gt;boolean&lt;/CODE&gt; ( &lt;CODE&gt;true&lt;/CODE&gt; or a &lt;CODE&gt;false&lt;/CODE&gt; ).  So this saying: "assign "1" to &lt;CODE&gt;UseInSummary&lt;/CODE&gt; whenever &lt;CODE&gt;Type&lt;/CODE&gt; starts with the string &lt;CODE&gt;packet_&lt;/CODE&gt; AND &lt;CODE&gt;ResultCalculated&lt;/CODE&gt; is &lt;CODE&gt;1&lt;/CODE&gt; (that's just one line).  So you do all the "positive" cases and then default 'UseInSummary&lt;CODE&gt;to&lt;/CODE&gt;0` otherwise.  Proper spacing and linebreaking helps to provide clarity in Splunk; try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval UseInSummary=case(
       (sourcetype="HTTP-RESULTS" AND Status="SUCCESS" AND Protocol="HTTP"), 1,
       (like(Type,"packet_%") AND ResultCalculated=1),                       1,
       (like(Type,"seeder_%") AND ResultCalculated=1 AND Result&amp;lt;200),        1,
       (Type="latent" AND ResultCalculated=1 AND Result&amp;lt;1000),               1,
       true(),                                                               0)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Aug 2017 19:27:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304979#M166319</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-08-29T19:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: Like function overview?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304980#M166320</link>
      <description>&lt;P&gt;Thanks Woodcock, much appreciated your detailed response.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2017 19:46:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Like-function-overview/m-p/304980#M166320</guid>
      <dc:creator>jassikul</dc:creator>
      <dc:date>2017-08-29T19:46:38Z</dc:date>
    </item>
  </channel>
</rss>

