<?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: Split square bracket expression in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Split-square-bracket-expression-How-to-separate-out-below-fields/m-p/655845#M226516</link>
    <description>&lt;P&gt;It would help to know what results your query returned and why those results aren't good enough.&lt;/P&gt;&lt;P&gt;I prefer the &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; command for extracting fields.&amp;nbsp; The regular expressions below look for the given keyword then extract what's between the following square brackets.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "Namespace \[(?&amp;lt;Namespace&amp;gt;[^\]]+)"
| rex "ServiceName \[(?&amp;lt;ServiceName&amp;gt;[^\]]+)"
| rex "Version \[(?&amp;lt;Version&amp;gt;[^\]]+)"
| stats latest(Namespace) as Namespace latest(ServiceName) as ServiceName latest(Version) as Version by host
| sort -Version&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Aug 2023 13:49:09 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-08-28T13:49:09Z</dc:date>
    <item>
      <title>Split square bracket expression: How to separate out below fields in table format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-square-bracket-expression-How-to-separate-out-below-fields/m-p/655835#M226515</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I want to separate out below fields in table format.&lt;/P&gt;
&lt;P&gt;Raw = Namespace [com.sampple.ne.vas.events], ServiceName [flp-eg-cg], Version [0.0.1], isActive [true], AppliationType [EVENT]&lt;/P&gt;
&lt;P&gt;Query I am using =&lt;BR /&gt;| eval Namespace=mvindex(split(mvindex(split(_raw, "Namespace "),1),"],"),1)&lt;BR /&gt;| eval ServiceName=mvindex(split(mvindex(split(_raw,"ServiceName "),1),"],"),0)&lt;BR /&gt;| eval Version=mvindex(split(mvindex(split(_raw,"Version "),1),"],"),0)&lt;BR /&gt;| stats&amp;nbsp;latest(Namespace) as Namespace latest(ServiceName) as ServiceName latest(Version) as Version by host&lt;BR /&gt;| sort -Version&lt;/P&gt;
&lt;P&gt;Expected result&lt;/P&gt;
&lt;TABLE width="296"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;Host&lt;/TD&gt;
&lt;TD width="84"&gt;AppName&lt;/TD&gt;
&lt;TD width="84"&gt;ServiceName&lt;/TD&gt;
&lt;TD width="64"&gt;Version&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 18:56:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-square-bracket-expression-How-to-separate-out-below-fields/m-p/655835#M226515</guid>
      <dc:creator>drogo</dc:creator>
      <dc:date>2023-08-28T18:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Split square bracket expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-square-bracket-expression-How-to-separate-out-below-fields/m-p/655845#M226516</link>
      <description>&lt;P&gt;It would help to know what results your query returned and why those results aren't good enough.&lt;/P&gt;&lt;P&gt;I prefer the &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; command for extracting fields.&amp;nbsp; The regular expressions below look for the given keyword then extract what's between the following square brackets.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "Namespace \[(?&amp;lt;Namespace&amp;gt;[^\]]+)"
| rex "ServiceName \[(?&amp;lt;ServiceName&amp;gt;[^\]]+)"
| rex "Version \[(?&amp;lt;Version&amp;gt;[^\]]+)"
| stats latest(Namespace) as Namespace latest(ServiceName) as ServiceName latest(Version) as Version by host
| sort -Version&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 13:49:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-square-bracket-expression-How-to-separate-out-below-fields/m-p/655845#M226516</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-08-28T13:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Split square bracket expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-square-bracket-expression-How-to-separate-out-below-fields/m-p/655847#M226518</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex max_match=0 "(?&amp;lt;keyvalue&amp;gt;\w+\s\[[^\]]+)"
| mvexpand keyvalue
| rex field=keyvalue "(?&amp;lt;key&amp;gt;\w+)\s\[(?&amp;lt;value&amp;gt;[^\]]+)"
| eval {key}=value
| fields - keyvalue key value
| stats values(*) as * by _raw&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 28 Aug 2023 13:53:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-square-bracket-expression-How-to-separate-out-below-fields/m-p/655847#M226518</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-28T13:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Split square bracket expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-square-bracket-expression-How-to-separate-out-below-fields/m-p/655852#M226520</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 14:31:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-square-bracket-expression-How-to-separate-out-below-fields/m-p/655852#M226520</guid>
      <dc:creator>drogo</dc:creator>
      <dc:date>2023-08-28T14:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Split square bracket expression</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-square-bracket-expression-How-to-separate-out-below-fields/m-p/655853#M226521</link>
      <description>&lt;P&gt;@hanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;this help&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 14:32:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-square-bracket-expression-How-to-separate-out-below-fields/m-p/655853#M226521</guid>
      <dc:creator>drogo</dc:creator>
      <dc:date>2023-08-28T14:32:38Z</dc:date>
    </item>
  </channel>
</rss>

