<?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: comparing two string doesn't work in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650738#M224997</link>
    <description>&lt;P&gt;You're comparing two strings which will never match.&lt;/P&gt;&lt;P&gt;You need to use single quotes for the field name&lt;/P&gt;&lt;PRE&gt;'Properties.URL' like "%stg%"&lt;/PRE&gt;</description>
    <pubDate>Mon, 17 Jul 2023 06:21:41 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2023-07-17T06:21:41Z</dc:date>
    <item>
      <title>comparing two string doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650307#M224808</link>
      <description>&lt;P&gt;i have a search query and i want to add another condition to check the url if &lt;STRONG&gt;test!=staging&lt;/STRONG&gt;. the first test is coming as a parameter and could be test, staging or prod. i've done&amp;nbsp;following query but &lt;STRONG&gt;test!=staging&lt;/STRONG&gt; part doesn't work and not returning as true.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="my_index"
AND (test!=staging OR "Properties.URL"="*stg*")
source=Payments&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 01:42:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650307#M224808</guid>
      <dc:creator>rezaeimo</dc:creator>
      <dc:date>2023-07-13T01:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two string doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650322#M224812</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258635"&gt;@rezaeimo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you could try using quotes for the staging value:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="my_index" (test!="staging" OR "Properties.URL"="*stg*") source=Payments&lt;/LI-CODE&gt;&lt;P&gt;or you could try the other conditions: it's alwayes beter to use positive condition than negative ones:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="my_index" (test IN ("test","prod") OR "Properties.URL"="*stg*") source=Payments&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 06:22:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650322#M224812</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-13T06:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two string doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650471#M224877</link>
      <description>&lt;P&gt;for me the fix was to use where keyword.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="my_index"
source=Payments
|search ("test" !="staging" OR "Properties.URL"="*stg*")&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 Jul 2023 04:14:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650471#M224877</guid>
      <dc:creator>rezaeimo</dc:creator>
      <dc:date>2023-07-14T04:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two string doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650485#M224882</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258635"&gt;@rezaeimo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you don't need to use the search command after the main search, this ommand is used only if you have to use a field not defined in the main search.&lt;/P&gt;&lt;P&gt;in addition you don't need to use quotes for fields without spaces or special chars.&lt;/P&gt;&lt;P&gt;Ciao,.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2023 06:32:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650485#M224882</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-14T06:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two string doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650726#M224991</link>
      <description>&lt;P&gt;i've used where key word like the following. now the first condition works but the second condition doesn't work. name is a parameter that could be test, staging or prod. do you have any idea why the second condition doesn't work?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="my_index"
source=Payments
|where ("#{name}"!="staging" OR "Properties.URL" like "%stg%")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jul 2023 23:40:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650726#M224991</guid>
      <dc:creator>rezaeimo</dc:creator>
      <dc:date>2023-07-16T23:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two string doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650735#M224996</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258635"&gt;@rezaeimo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I'm not sure about the conditions you used and sometimes the dot in the field name gives problems, so please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="my_index" source=Payments
| rename Properties.URL AS URL
| search ("test"!="staging" OR URL like "%stg%")&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 06:01:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650735#M224996</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-17T06:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two string doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650738#M224997</link>
      <description>&lt;P&gt;You're comparing two strings which will never match.&lt;/P&gt;&lt;P&gt;You need to use single quotes for the field name&lt;/P&gt;&lt;PRE&gt;'Properties.URL' like "%stg%"&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Jul 2023 06:21:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650738#M224997</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-07-17T06:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two string doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650739#M224998</link>
      <description>&lt;P&gt;great idea to use rename, thanks for that. . didn't worked with search but i've used rename and where and it got it working. here is what worked for me.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="my_index"
source=Payments
|rename "Properties.URL" as Url 
|where ("#{name}"!="staging" OR Url like "%stg%")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 06:29:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650739#M224998</guid>
      <dc:creator>rezaeimo</dc:creator>
      <dc:date>2023-07-17T06:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two string doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650749#M225001</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258635"&gt;@rezaeimo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;as I said, this is a frequent issue that I don't understand why someone in Splunk doesn't resolve!&lt;/P&gt;&lt;P&gt;Anyway,&amp;nbsp;&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;let us know if we can help you more, or, please, accept one answer for the other people of Community.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 07:18:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650749#M225001</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-17T07:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two string doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650753#M225002</link>
      <description>&lt;P&gt;That's not a real issue. If you have field names consisting of more than just alphanumeric characters, you use single quotes to define them. In fact you can use the single quotes every time, it's just that with "simple" field names you can omit them.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 07:32:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-string-doesn-t-work/m-p/650753#M225002</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-07-17T07:32:55Z</dc:date>
    </item>
  </channel>
</rss>

