<?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: Extracting values inside of a [] , which are , separated with spaces in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-inside-of-a-which-are-separated-with-spaces/m-p/689601#M234976</link>
    <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;says, "not working as expected", "doesn't work", etc., should be forbidden in this forum. &amp;nbsp;More specifically, if your raw events contain things like&amp;nbsp;"letterIdAndDeliveryIndicatorMap=[abc=P, efg=P, HijKlmno=E]", Splunk's default extraction should have given you &lt;U&gt;abc&lt;/U&gt;, &lt;U&gt;efg&lt;/U&gt;, &lt;U&gt;HijKlmlo&lt;/U&gt; without you asking. (It also gives you a field&amp;nbsp;letterIdAndDeliveryIndicatorMap.) If you do &lt;FONT face="courier new,courier"&gt;table *&lt;/FONT&gt;, what do you see?&lt;/P&gt;&lt;P&gt;Here is an emulation&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="letterIdAndDeliveryIndicatorMap=[abc=P, efg=P, HijKlmno=E]"
| extract&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-06-04 at 11.58.13 AM.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31147iBEEFD8D0AFBF3F23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-06-04 at 11.58.13 AM.png" alt="Screenshot 2024-06-04 at 11.58.13 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Tue, 04 Jun 2024 19:00:26 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2024-06-04T19:00:26Z</dc:date>
    <item>
      <title>Extracting values inside of a [] , which are , separated with spaces</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-inside-of-a-which-are-separated-with-spaces/m-p/689588#M234967</link>
      <description>&lt;P&gt;trying to use rex to get the contents for the field &lt;SPAN&gt;letterIdAndDeliveryIndicatorMap&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;For example, Logged string&amp;nbsp;&lt;SPAN&gt;letterIdAndDeliveryIndicatorMap=[abc=P, efg=P, HijKlmno=E]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I wan&lt;/SPAN&gt;&lt;SPAN&gt;t to extract the contents between the [] , which is&amp;nbsp;abc=P, efg=P, HijKlmno=E and then find stats on them.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I was trying something like&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;rex&amp;nbsp; field=_raw "letterIdAndDeliveryIndicatorMap=\[(?&amp;lt;letterIdAry&amp;gt;[^\] ]+)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but, its not working as expected.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 16:38:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-inside-of-a-which-are-separated-with-spaces/m-p/689588#M234967</guid>
      <dc:creator>RamMur</dc:creator>
      <dc:date>2024-06-04T16:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values inside of a [] , which are , separated with spaces</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-inside-of-a-which-are-separated-with-spaces/m-p/689592#M234971</link>
      <description>&lt;P&gt;What do you mean by "not working as expected" (because it looks like you should have extracted something at least)?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 16:58:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-inside-of-a-which-are-separated-with-spaces/m-p/689592#M234971</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-06-04T16:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values inside of a [] , which are , separated with spaces</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-inside-of-a-which-are-separated-with-spaces/m-p/689593#M234972</link>
      <description>&lt;P&gt;yes, found that my regex had a space between ]], once fixed, was able to extract them as "&lt;SPAN&gt;abc=P, efg=P, HijKlmno=E"&lt;/SPAN&gt; , thanks. next trying to get stats on count of&amp;nbsp;&lt;SPAN&gt;abc=P.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 17:03:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-inside-of-a-which-are-separated-with-spaces/m-p/689593#M234972</guid>
      <dc:creator>RamMur</dc:creator>
      <dc:date>2024-06-04T17:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values inside of a [] , which are , separated with spaces</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-inside-of-a-which-are-separated-with-spaces/m-p/689595#M234973</link>
      <description>&lt;P&gt;You should be able to use the split function after extracting which will convert it to a MV field and then utilize a stats against that MV field.&lt;BR /&gt;Something like this&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;base_search&amp;gt;
    | rex field=_raw "letterIdAndDeliveryIndicatorMap=\[(?&amp;lt;letterIdAry&amp;gt;[^\]]+)"
    | eval
        letterIdAry=split(letterIdAry, ","),
        letterIdAry=case(
            mvcount(letterIdAry)==1, trim(letterIdAry, " "),
            mvcount(letterIdAry)&amp;gt;1, mvmap(letterIdAry, trim(letterIdAry, " "))
            )
    | stats
        count as event_count
            by letterIdAry&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Example output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dtburrows3_0-1717523007986.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31146i658F3A87C5436B2C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dtburrows3_0-1717523007986.png" alt="dtburrows3_0-1717523007986.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 17:43:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-inside-of-a-which-are-separated-with-spaces/m-p/689595#M234973</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2024-06-04T17:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values inside of a [] , which are , separated with spaces</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-inside-of-a-which-are-separated-with-spaces/m-p/689601#M234976</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;says, "not working as expected", "doesn't work", etc., should be forbidden in this forum. &amp;nbsp;More specifically, if your raw events contain things like&amp;nbsp;"letterIdAndDeliveryIndicatorMap=[abc=P, efg=P, HijKlmno=E]", Splunk's default extraction should have given you &lt;U&gt;abc&lt;/U&gt;, &lt;U&gt;efg&lt;/U&gt;, &lt;U&gt;HijKlmlo&lt;/U&gt; without you asking. (It also gives you a field&amp;nbsp;letterIdAndDeliveryIndicatorMap.) If you do &lt;FONT face="courier new,courier"&gt;table *&lt;/FONT&gt;, what do you see?&lt;/P&gt;&lt;P&gt;Here is an emulation&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="letterIdAndDeliveryIndicatorMap=[abc=P, efg=P, HijKlmno=E]"
| extract&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-06-04 at 11.58.13 AM.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31147iBEEFD8D0AFBF3F23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-06-04 at 11.58.13 AM.png" alt="Screenshot 2024-06-04 at 11.58.13 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 19:00:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-inside-of-a-which-are-separated-with-spaces/m-p/689601#M234976</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-06-04T19:00:26Z</dc:date>
    </item>
  </channel>
</rss>

