<?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 eval case match a fields value as a substring to another field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412004#M118802</link>
    <description>&lt;P&gt;I tried the match() command in eval case, but it is always giving me a result "NotFound", even if there is a match. &lt;BR /&gt;
So I checked the documentation and found that we have 3 possibilities:-&lt;BR /&gt;
1. match(SUBJECT, "REGEX") -&lt;BR /&gt;
2. like(TEXT, PATTERN) :- &lt;BR /&gt;
3. in(VALUE-LIST)&lt;/P&gt;

&lt;P&gt;In all 3 cases, The first argument is shown as the field but the second argument is some string. &lt;/P&gt;</description>
    <pubDate>Thu, 28 Jun 2018 07:48:17 GMT</pubDate>
    <dc:creator>Chandras11</dc:creator>
    <dc:date>2018-06-28T07:48:17Z</dc:date>
    <item>
      <title>Can eval case match a fields value as a substring to another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412002#M118800</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="index1" sourcetype="SC1" OR sourcetype="SC2"  | eval Ticket_Main5 = (Ticket,1,5)| eval Ticket_master = case(sourcetype="SC2" AND like(LINK_LIST, Ticket_Main5),SC2_Ticket,1=1,"NotFound")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For example &lt;CODE&gt;Ticket= "Z1234B" and LINK_LIST is "C1234A001;Z1234A;Z1234B" and SC2_Ticket is "C1234A"&lt;/CODE&gt; . So I need to extract Ticket_Main5 first. Then check this field in another field LINK_LIST inside eval case. There are other arguments in eval case as well, which I removed here. &lt;/P&gt;

&lt;P&gt;Or is there any other way, where I can check if a field value is a substring of other field value. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:12:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412002#M118800</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2020-09-29T20:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can eval case match a fields value as a substring to another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412003#M118801</link>
      <description>&lt;P&gt;@Chandras11, please try the following run anywhere example based on the details provided.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval Ticket="Z1234B", LINK_LIST="C1234A001;Z1234A;Z1234B" , sourcetype="SC2" 
| eval Ticket_Main5 = substr(Ticket,1,13) 
| eval Ticket_master = case(sourcetype="SC2" AND match(LINK_LIST, Ticket_Main5),"SC2_Ticket",true(),"NotFound")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jun 2018 07:32:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412003#M118801</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-28T07:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Can eval case match a fields value as a substring to another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412004#M118802</link>
      <description>&lt;P&gt;I tried the match() command in eval case, but it is always giving me a result "NotFound", even if there is a match. &lt;BR /&gt;
So I checked the documentation and found that we have 3 possibilities:-&lt;BR /&gt;
1. match(SUBJECT, "REGEX") -&lt;BR /&gt;
2. like(TEXT, PATTERN) :- &lt;BR /&gt;
3. in(VALUE-LIST)&lt;/P&gt;

&lt;P&gt;In all 3 cases, The first argument is shown as the field but the second argument is some string. &lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 07:48:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412004#M118802</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-06-28T07:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Can eval case match a fields value as a substring to another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412005#M118803</link>
      <description>&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.1.1/SearchReference/ConditionalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/7.1.1/SearchReference/ConditionalFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 07:54:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412005#M118803</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-06-28T07:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Can eval case match a fields value as a substring to another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412006#M118804</link>
      <description>&lt;P&gt;@Chandras11, you might have to provide some raw sample event which is not working as expected.&lt;/P&gt;

&lt;P&gt;I tried run anywhere search based on details provided and that works fine! I tested with Z1234A, Z1234B andZ1234C.&lt;/P&gt;

&lt;P&gt;For A &amp;amp; B I got result as &lt;CODE&gt;SC2_Ticket&lt;/CODE&gt; and for C &lt;CODE&gt;NotFound&lt;/CODE&gt;. So next thing would be to figure out why the same would not work with Raw data.&lt;/P&gt;

&lt;P&gt;Also, once you have identified them as SC2_Ticket and NotFound, is there subsequent activity you need to perform or is that the final pipe?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 08:02:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412006#M118804</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-28T08:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Can eval case match a fields value as a substring to another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412007#M118805</link>
      <description>&lt;P&gt;hi, could there be trailing spaces involved? can you use a trim function to trim your fields before applying substr or case functions?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 08:09:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412007#M118805</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-06-28T08:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can eval case match a fields value as a substring to another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412008#M118806</link>
      <description>&lt;P&gt;No, there is no trailing space but it seems that the problem is involving 2 different source types with same field names. &lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 08:24:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412008#M118806</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-06-28T08:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Can eval case match a fields value as a substring to another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412009#M118807</link>
      <description>&lt;P&gt;inally I found some issue with my query. Ticket="Z1234B" is in sourcetype="SC1" and LINK_LIST is in sourcetype="SC2". If I remove sourcetype="SC2", the search will give me the results. The problem is that both sourcetype="SC1" and sourcetype="SC2" has a field called LINK_LIST and I just want to check it in "SC2" only. &lt;BR /&gt;
I tried it with eval sub search and join but I am not able to resolve it. The other question is posted at &lt;A href="https://answers.splunk.com/answers/668508/parameter-passing-between-2-searches-as-input-as-w.html" target="_blank"&gt;https://answers.splunk.com/answers/668508/parameter-passing-between-2-searches-as-input-as-w.html&lt;/A&gt; : where you can find some dummy row data &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:13:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412009#M118807</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2020-09-29T20:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can eval case match a fields value as a substring to another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412010#M118808</link>
      <description>&lt;P&gt;What I really need the value of SC2_Ticket from the first event where Ticket_Main5 (SC1) is in LINK_LIST of SC2. "SC2_Ticket" as a string won't help.&lt;BR /&gt;
However, It is possible to rename the fields for both sourcetypes and then combine another query to get the results &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:13:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412010#M118808</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2020-09-29T20:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Can eval case match a fields value as a substring to another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412011#M118809</link>
      <description>&lt;P&gt;@Chandra11, you can add the following eval to create two new fields i.e. SC1_LINK_LIST and SC2_LINK_LIST and use required column as per your need.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval {sourcetype}_LINK_LIST=LINK_LIST
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is a run anywhere search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval LINK_LIST="A,B", sourcetype="SC1" 
| append 
    [| makeresults 
    | eval LINK_LIST="A B", sourcetype="SC2"]
| eval {sourcetype}_LINK_LIST=LINK_LIST
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:13:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412011#M118809</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-29T20:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can eval case match a fields value as a substring to another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412012#M118810</link>
      <description>&lt;P&gt;perfect, thanks for it. I can also use:- index="index1" sourcetype="SC1" OR sourcetype="SC2"  | eval SC2_Link_List = if(sourcetype="SC2",LINK_LIST,null()) &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:13:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-eval-case-match-a-fields-value-as-a-substring-to-another/m-p/412012#M118810</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2020-09-29T20:13:13Z</dc:date>
    </item>
  </channel>
</rss>

