<?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 How to create an eval and use of like? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613375#M213172</link>
    <description>&lt;DIV class=""&gt;I am trying to an eval with like to assign priority to certain IPs/hosts and running into an issue where the priority is not being assigned. I am using network data to create my ES asset list and I have a lookup that does IP to cidr range and then returns the zone the IP is associated with. Later in my search I rename zone to bunit and right after that I am testing the eval as follows:&lt;/DIV&gt;
&lt;PRE&gt;| eval priority=if(like(bunit,"%foo%"), "critical" , "TBD")&lt;/PRE&gt;
&lt;DIV class=""&gt;As I am testing the search at the end of my search I have:&lt;/DIV&gt;
&lt;PRE&gt;| table ip, mac, nt_host, dns, owner, priority, lat, long, city, country, bunit, category, pci_domain, is_expected, should_timesync, should_update, requires_av, device, interface
| search bunit=*foo*&lt;/PRE&gt;
&lt;DIV class=""&gt;I get a list of all foo related bunit events, but the priority field is set to "TBD"&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;Would appreciate any help - thx&lt;/DIV&gt;</description>
    <pubDate>Fri, 16 Sep 2022 17:49:10 GMT</pubDate>
    <dc:creator>jwalzerpitt</dc:creator>
    <dc:date>2022-09-16T17:49:10Z</dc:date>
    <item>
      <title>How to create an eval and use of like?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613375#M213172</link>
      <description>&lt;DIV class=""&gt;I am trying to an eval with like to assign priority to certain IPs/hosts and running into an issue where the priority is not being assigned. I am using network data to create my ES asset list and I have a lookup that does IP to cidr range and then returns the zone the IP is associated with. Later in my search I rename zone to bunit and right after that I am testing the eval as follows:&lt;/DIV&gt;
&lt;PRE&gt;| eval priority=if(like(bunit,"%foo%"), "critical" , "TBD")&lt;/PRE&gt;
&lt;DIV class=""&gt;As I am testing the search at the end of my search I have:&lt;/DIV&gt;
&lt;PRE&gt;| table ip, mac, nt_host, dns, owner, priority, lat, long, city, country, bunit, category, pci_domain, is_expected, should_timesync, should_update, requires_av, device, interface
| search bunit=*foo*&lt;/PRE&gt;
&lt;DIV class=""&gt;I get a list of all foo related bunit events, but the priority field is set to "TBD"&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;Would appreciate any help - thx&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Sep 2022 17:49:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613375#M213172</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-09-16T17:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Having issue with eval and use of like</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613383#M213176</link>
      <description>&lt;P&gt;Are you sure that bunit is not a multi value field?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 12:18:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613383#M213176</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-09-16T12:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Having issue with eval and use of like</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613401#M213180</link>
      <description>&lt;P&gt;&lt;SPAN&gt;bunit&amp;nbsp;just has one value per IP&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:04:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613401#M213180</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-09-16T13:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Having issue with eval and use of like</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613404#M213182</link>
      <description>&lt;P&gt;My apologies as reviewing the search output I need to dedup fields with bunit being one of those fields. Here is my entire search:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=arp sourcetype=foo_arp NOT mac IN (incomplete) 
| lookup securitygroupmembers_lookup cidr_range as ip 
| lookup dnslookup clientip as ip OUTPUT clienthost as dns 
| fillnull value=NULL 
| search zone!="" 
| eval zone=coalesce(zone,"null")
| rename zone AS bunit 
| eval priority=if(like(bunit,"%foo%"), "critical" , "TBD")
| eval ip=mvdedup(ip), mac=mvdedup(mac), dns=mvdedup(dns), bunit=mvdedup(bunit), device=mvdedup(device), interface=mvdedup(interface)
| table ip, mac, nt_host, dns, owner, priority, lat, long, city, country, bunit, category, pci_domain, is_expected, should_timesync, should_update, requires_av, device, interface
| search bunit=*foo*&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For some reason I am getting dupes in various fields so I use an eval to dedup those fields. With bunit being a multi value field, what effect does that have?&lt;/P&gt;&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:20:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613404#M213182</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-09-16T13:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Having issue with eval and use of like</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613411#M213185</link>
      <description>&lt;P&gt;Multivalue fields has different behaviour than "normal" single value fields.&lt;/P&gt;&lt;P&gt;Can you try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;eval priority=if(isnotnull(mvfind(bunit,"foo")), "critical" , "TBD")&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.1/SearchReference/MultivalueEvalFunctions#mvfind.28MVFIELD.2C.22REGEX.22.29" target="_blank"&gt;mvfind(MVFIELD,"REGEX")&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:38:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613411#M213185</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-09-16T13:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Having issue with eval and use of like</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613416#M213188</link>
      <description>&lt;P&gt;That worked after making a slight change so TYVM!&lt;/P&gt;&lt;P&gt;At first when I used the following, the priority field was still coming back as TBD&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval priority=if(isnotnull(mvfind(bunit,"fis")), "critical" , "TBD")&lt;/LI-CODE&gt;&lt;P&gt;However, when I made the change from&amp;nbsp;&lt;EM&gt;isnotnull&lt;/EM&gt; to&amp;nbsp;&lt;EM&gt;isnull&lt;/EM&gt; (and added % to foo) the bunit field was now tagged as critical&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval priority=if(isnull(mvfind(bunit,"%foo%")), "critical" , "TBD")&lt;/LI-CODE&gt;&lt;P&gt;Is it possible to search for multiple values in the bunit filed in the eval like as follows? I have a list of zones/bunits I need to tag as critical&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval priority=if(isnull(mvfind(bunit,"%foo%", "%bar%, "%abc%)), "critical" , "TBD")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Thx again!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:49:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613416#M213188</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-09-16T13:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Having issue with eval and use of like</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613418#M213189</link>
      <description>&lt;P&gt;As mvfind use regex to match, you could use what it offer. Easy place to test those is regex101.com.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:51:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613418#M213189</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-09-16T13:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Having issue with eval and use of like</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613420#M213190</link>
      <description>&lt;P&gt;Thx again&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 14:03:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613420#M213190</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-09-16T14:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Having issue with eval and use of like</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613430#M213196</link>
      <description>&lt;P&gt;One issue I see is that with using isnull/isnotnull as follows, it tags all values from the bunits field as critical:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval priority=if(isnull(mvfind(bunit,"(%foo%)")), "critical" , "TBD")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a better information function (&lt;A href="https://docs.splunk.com/Documentation/SCS/current/SearchReference/InformationalFunctions#isstr.28.26lt.3Bvalue.26gt.3B.29" target="_blank"&gt;https://docs.splunk.com/Documentation/SCS/current/SearchReference/InformationalFunctions#isstr.28.26lt.3Bvalue.26gt.3B.29&lt;/A&gt;) to use?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 14:54:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-eval-and-use-of-like/m-p/613430#M213196</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-09-16T14:54:48Z</dc:date>
    </item>
  </channel>
</rss>

