<?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: Conditional search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Conditional-search-How-to-use-negative-search-in-case-command/m-p/629766#M218781</link>
    <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;case&lt;/FONT&gt; function takes arguments in pairs.&amp;nbsp; The first half of the pair must be a boolean expression and the second half must be non-boolean.&amp;nbsp; It is this non-boolean value that is assigned to TXT.&lt;/P&gt;&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;like&lt;/FONT&gt; function requires two aruments.&amp;nbsp; The first is a field name and the second is a SQL pattern to compare the field value against.&amp;nbsp; If the field value matches the pattern then the function returns true; otherwise, it returns false.&lt;/P&gt;&lt;P&gt;Perhaps you only need a &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; command to filter out the undesired events.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where (URL!="A" OR (URL="A" AND NOT like(TXT, "%others%")))&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 06 Feb 2023 16:46:27 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-02-06T16:46:27Z</dc:date>
    <item>
      <title>Conditional search: How to use negative search in case command ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-search-How-to-use-negative-search-in-case-command/m-p/629758#M218776</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I got these datas&lt;/P&gt;
&lt;TABLE width="447"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="149"&gt;URI&lt;/TD&gt;
&lt;TD width="149"&gt;TXT&lt;/TD&gt;
&lt;TD width="149"&gt;Param&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;My text and others&lt;/TD&gt;
&lt;TD&gt;param 1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;My text and others&lt;/TD&gt;
&lt;TD&gt;param 2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;My text&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;param 3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;My text&lt;/TD&gt;
&lt;TD&gt;param 4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;My text and others&lt;/TD&gt;
&lt;TD&gt;param 2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;My text&lt;/TD&gt;
&lt;TD&gt;param 3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;My text and others&lt;/TD&gt;
&lt;TD&gt;param 1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;My text&lt;/TD&gt;
&lt;TD&gt;param4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;I'd like to extract the datas according these rules :&lt;/P&gt;
&lt;P&gt;- If URI = A, extract TXT that not contains "others"&lt;/P&gt;
&lt;P&gt;- Else extract all&lt;/P&gt;
&lt;P&gt;to obtain these results&lt;/P&gt;
&lt;TABLE width="447px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="148.617px"&gt;URI&lt;/TD&gt;
&lt;TD width="148.683px"&gt;TXT&lt;/TD&gt;
&lt;TD width="148.7px"&gt;Param&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="148.617px"&gt;A&lt;/TD&gt;
&lt;TD width="148.683px"&gt;My text&amp;nbsp;&lt;/TD&gt;
&lt;TD width="148.7px"&gt;param 3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="148.617px"&gt;A&lt;/TD&gt;
&lt;TD width="148.683px"&gt;My text&lt;/TD&gt;
&lt;TD width="148.7px"&gt;param 4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="148.617px"&gt;B&lt;/TD&gt;
&lt;TD width="148.683px"&gt;My text and others&lt;/TD&gt;
&lt;TD width="148.7px"&gt;param 2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="148.617px"&gt;B&lt;/TD&gt;
&lt;TD width="148.683px"&gt;My text&lt;/TD&gt;
&lt;TD width="148.7px"&gt;param 3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="148.617px"&gt;C&lt;/TD&gt;
&lt;TD width="148.683px"&gt;My text and others&lt;/TD&gt;
&lt;TD width="148.7px"&gt;param 1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="148.617px"&gt;C&lt;/TD&gt;
&lt;TD width="148.683px"&gt;My text&lt;/TD&gt;
&lt;TD width="148.7px"&gt;param4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know how to build my request.&lt;/P&gt;
&lt;P&gt;I try to use "case" command like this but it return a logical error (Error in 'EvalCommand': The arguments to the 'like' function are invalid. ) :&lt;/P&gt;
&lt;P&gt;...&lt;BR /&gt;|eval TXT=case(URI="A", NOT LIKE("%others%"), 1=1, "others")&lt;BR /&gt;...&lt;/P&gt;
&lt;P&gt;How to use negative search in case command ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 17:57:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-search-How-to-use-negative-search-in-case-command/m-p/629758#M218776</guid>
      <dc:creator>mxh7777</dc:creator>
      <dc:date>2023-02-06T17:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-search-How-to-use-negative-search-in-case-command/m-p/629766#M218781</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;case&lt;/FONT&gt; function takes arguments in pairs.&amp;nbsp; The first half of the pair must be a boolean expression and the second half must be non-boolean.&amp;nbsp; It is this non-boolean value that is assigned to TXT.&lt;/P&gt;&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;like&lt;/FONT&gt; function requires two aruments.&amp;nbsp; The first is a field name and the second is a SQL pattern to compare the field value against.&amp;nbsp; If the field value matches the pattern then the function returns true; otherwise, it returns false.&lt;/P&gt;&lt;P&gt;Perhaps you only need a &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; command to filter out the undesired events.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where (URL!="A" OR (URL="A" AND NOT like(TXT, "%others%")))&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 06 Feb 2023 16:46:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-search-How-to-use-negative-search-in-case-command/m-p/629766#M218781</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-02-06T16:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-search-How-to-use-negative-search-in-case-command/m-p/630062#M218876</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;This better with "where"&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 09:56:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-search-How-to-use-negative-search-in-case-command/m-p/630062#M218876</guid>
      <dc:creator>mxh7777</dc:creator>
      <dc:date>2023-02-08T09:56:17Z</dc:date>
    </item>
  </channel>
</rss>

