<?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: How Can I Create a Search To Compare 2 Fields with LIKE? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573910#M200002</link>
    <description>&lt;LI-CODE lang="markup"&gt;| eval result=if(like(lower(field1),"%".lower(field2)."%") OR like(lower(field2),"%".lower(field1)."%"),"hit","miss")&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 06 Nov 2021 13:52:34 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-11-06T13:52:34Z</dc:date>
    <item>
      <title>How Can I Create a Search To Compare 2 Fields with LIKE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573908#M200001</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I need to compare 2 fields with like command but I cant do it even if I tried many solutions.&lt;/P&gt;&lt;P&gt;For Example;&lt;/P&gt;&lt;PRE&gt;event1  field1="raceCar"  field2="car"
event2  field1="trying"  field2="hello"
event3  field1="splunk"  field2="helloSplunkEnterprise"&lt;/PRE&gt;&lt;P&gt;Desired result:&lt;/P&gt;&lt;PRE&gt;  event1  result=hit
  event2  result=miss
  event3  result=hit&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I tried | eval results= if (match()) but didnt work&lt;/P&gt;&lt;P&gt;Is there any suggestion about this SPL?&lt;/P&gt;&lt;P&gt;Thanks alot for your helps&lt;/P&gt;</description>
      <pubDate>Sat, 06 Nov 2021 12:40:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573908#M200001</guid>
      <dc:creator>onur</dc:creator>
      <dc:date>2021-11-06T12:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Create a Search To Compare 2 Fields with LIKE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573910#M200002</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval result=if(like(lower(field1),"%".lower(field2)."%") OR like(lower(field2),"%".lower(field1)."%"),"hit","miss")&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 06 Nov 2021 13:52:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573910#M200002</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-11-06T13:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Create a Search To Compare 2 Fields with LIKE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573911#M200003</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for your reply. When I tried this search, the problem is not solved. I am leaving 2 field below. These fields dont match.&lt;/P&gt;&lt;P&gt;Source1 =&amp;nbsp;&lt;SPAN&gt;536456786786_454AS6DASD-98SAD-787RET-98SAD-GASDA54656&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Source2 = remote_splunk_.com_536456786786_454AS6DASD-98SAD-787RET-98SAD-GASDA54656&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;OR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Source1 = remote_splunk_.com_536456786786_454AS6DASD-98SAD-787RET-98SAD-GASDA54656&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Source2 =&amp;nbsp;&lt;SPAN&gt;536456786786_454AS6DASD-98SAD-787RET-98SAD-GASDA54656&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Nov 2021 14:03:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573911#M200003</guid>
      <dc:creator>onur</dc:creator>
      <dc:date>2021-11-06T14:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Create a Search To Compare 2 Fields with LIKE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573912#M200004</link>
      <description>&lt;P&gt;Here is a runanywhere example of the comparison working&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval field1="536456786786_454AS6DASD-98SAD-787RET-98SAD-GASDA54656"
| eval field2="remote_splunk_.com_536456786786_454AS6DASD-98SAD-787RET-98SAD-GASDA54656"
| eval result=if(like(lower(field1),"%".lower(field2)."%") OR like(lower(field2),"%".lower(field1)."%"),"hit","miss")&lt;/LI-CODE&gt;&lt;P&gt;If this is not your situation, you should expand on what exactly you are trying to do, perhaps with more realistic examples.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Nov 2021 14:17:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573912#M200004</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-11-06T14:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Create a Search To Compare 2 Fields with LIKE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573919#M200006</link>
      <description>&lt;P&gt;Actually, ı am trying to combine 2 searches. The first search is returning a search id in _audit index and the secone one is again returning a search id from _introspection index. In this way, I want to 2 combine these 2 searches and match the search id's. The main idea to create this search is that we want to find the total memory or cpu usage per ad hoc search.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Nov 2021 19:18:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573919#M200006</guid>
      <dc:creator>onur</dc:creator>
      <dc:date>2021-11-06T19:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Create a Search To Compare 2 Fields with LIKE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573930#M200009</link>
      <description>&lt;P&gt;Technically, the problem you first described is solved - you have now described a different problem. You are trying to "join" events where the joining field values only partially match.&lt;/P&gt;&lt;P&gt;Given your example, can you extract just the string you want to match on?&lt;/P&gt;&lt;P&gt;For example, if you can assume that the id is made up of numbers, uppercase letters, minus and underscore, and sometimes preceded by an underscore, you could try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval field1=split("536456786786_454AS6DASD-98SAD-787RET-98SAD-GASDA54656|remote_splunk_.com_536456786786_454AS6DASD-98SAD-787RET-98SAD-GASDA54656","|")
| mvexpand field1
| streamstats count as source
| eval name="datafrom".source
| eval {name}=random()%10 
| fields - name



| rex field=field1 max_match=0 "_?(?&amp;lt;id&amp;gt;[0-9A-Z_-]+)"
| eval id=mvindex(id,-1)
| stats values(*) as * by id&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 07 Nov 2021 09:21:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-Can-I-Create-a-Search-To-Compare-2-Fields-with-LIKE/m-p/573930#M200009</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-11-07T09:21:07Z</dc:date>
    </item>
  </channel>
</rss>

