<?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 to find square bracket in eval in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746145#M58689</link>
    <description>&lt;P&gt;The easiest way to see _raw is open event and select from “event actions” sho source.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="isoutamo_0-1747196649710.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/39002i1FA389D028A24BFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="isoutamo_0-1747196649710.png" alt="isoutamo_0-1747196649710.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;isoutamo_0-1747196649710.png&lt;/span&gt;&lt;/span&gt;&lt;BR /&gt;then you see if there is e.g. some escape characters like \u0022 =&amp;gt; “&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 May 2025 04:26:05 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2025-05-14T04:26:05Z</dc:date>
    <item>
      <title>How to find square bracket in eval</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746133#M58685</link>
      <description>&lt;P&gt;I need to find whether the string&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;["foobar"]&lt;/LI-CODE&gt;&lt;P&gt;exists in a log message.&amp;nbsp; I have a search query like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;some stuff
| eval hasFoobar = case(_raw LIKE "%\"foobar%", "Y")
| eval hasFoobar = if(hasFoobar = "Y", "YES", "NO")
| table message, hasFoobar &lt;/LI-CODE&gt;&lt;P&gt;which gives YESes as expected.&lt;/P&gt;&lt;P&gt;If I add a square bracket, whether escaped or not, I only get NOes.&amp;nbsp; E.g.,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;some stuff
| eval hasFoobar = case(_raw LIKE "%[\"foobar%", "Y")
| eval hasFoobar = if(hasFoobar = "Y", "YES", "NO")
| table message, hasFoobar &lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;some stuff
| eval hasFoobar = case(_raw LIKE "%\[\"foobar%", "Y")
| eval hasFoobar = if(hasFoobar = "Y", "YES", "NO")
| table message, hasFoobar &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 00:34:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746133#M58685</guid>
      <dc:creator>tamalunp</dc:creator>
      <dc:date>2025-05-14T00:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to find square bracket in eval</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746143#M58688</link>
      <description>&lt;P&gt;So this example shows that the LIKE works with the [&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="bla bla [\"foobar\"] bla bla"
| eval hasFoobar = case(_raw LIKE "%[\"foobar%", "Y")
| eval hasFoobar = if(hasFoobar = "Y", "YES", "NO")
| table _raw, hasFoobar &lt;/LI-CODE&gt;&lt;P&gt;so there may be something odd with your data. Your example shows table &lt;STRONG&gt;message,&amp;nbsp;&lt;/STRONG&gt;not _raw. Can you provide an example of _raw&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 04:11:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746143#M58688</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2025-05-14T04:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to find square bracket in eval</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746145#M58689</link>
      <description>&lt;P&gt;The easiest way to see _raw is open event and select from “event actions” sho source.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="isoutamo_0-1747196649710.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/39002i1FA389D028A24BFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="isoutamo_0-1747196649710.png" alt="isoutamo_0-1747196649710.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;isoutamo_0-1747196649710.png&lt;/span&gt;&lt;/span&gt;&lt;BR /&gt;then you see if there is e.g. some escape characters like \u0022 =&amp;gt; “&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 04:26:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746145#M58689</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2025-05-14T04:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to find square bracket in eval</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746155#M58690</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/197967"&gt;@tamalunp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could try with searchmatch maybe?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval isFoo=if(searchmatch("[\"foo\"]"),"yes","no")&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="livehybrid_0-1747204704335.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/39005i5DFA44CC04B50810/image-size/medium?v=v2&amp;amp;px=400" role="button" title="livehybrid_0-1747204704335.png" alt="livehybrid_0-1747204704335.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;livehybrid_0-1747204704335.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Full example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|windbag | head 1 | eval _raw="This is a test message [\"foo\"] bar"
| eval isFoo=if(searchmatch("[\"foo\"]"),"yes","no")
| table _raw isFoo&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 06:38:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746155#M58690</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-05-14T06:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to find square bracket in eval</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746250#M58695</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva" size="3"&gt;This seemed like the solution at first, but there's a little quirk.&lt;/FONT&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;foo
| eval hasFoo = if (searchmatch("\"foo\"]"), "YES", "NO")
| table _raw hasFoo&lt;/LI-CODE&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;In the case where _raw is like&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... ["foo", "bar"] ...&lt;/LI-CODE&gt;&lt;P&gt;hasFoo evaluates to "YES".&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2025 13:58:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746250#M58695</guid>
      <dc:creator>tamalunp</dc:creator>
      <dc:date>2025-05-15T13:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to find square bracket in eval</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746282#M58697</link>
      <description>&lt;P&gt;_raw is like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... \"products\": [\"foo\", \"bar\"], ...&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 15 May 2025 20:31:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-find-square-bracket-in-eval/m-p/746282#M58697</guid>
      <dc:creator>tamalunp</dc:creator>
      <dc:date>2025-05-15T20:31:30Z</dc:date>
    </item>
  </channel>
</rss>

