<?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 split string with square brackets into individual fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/580996#M202412</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm new to Splunk and I'm looking for some advice.&lt;/P&gt;&lt;P&gt;My search, e.g.&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;&amp;lt;mysearch&amp;gt; | table attributes&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;returns a value in the following format:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;name[test 1]srcintf[int1]dstintf[int2]srcaddr[address1]dstaddr[dest1 dest2]service[svc1 svc2 svc3]comments[test comment here]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I would like to split the output into individual fields. The values are within square brackets, i.e.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;name&lt;/TD&gt;&lt;TD width="50%"&gt;test 1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;srcintf&lt;/TD&gt;&lt;TD width="50%"&gt;int1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;dstintf&lt;/TD&gt;&lt;TD width="50%"&gt;int2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;...&lt;/TD&gt;&lt;TD width="50%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jan 2022 17:48:14 GMT</pubDate>
    <dc:creator>plcd63</dc:creator>
    <dc:date>2022-01-13T17:48:14Z</dc:date>
    <item>
      <title>split string with square brackets into individual fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/580996#M202412</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm new to Splunk and I'm looking for some advice.&lt;/P&gt;&lt;P&gt;My search, e.g.&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;&amp;lt;mysearch&amp;gt; | table attributes&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;returns a value in the following format:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;name[test 1]srcintf[int1]dstintf[int2]srcaddr[address1]dstaddr[dest1 dest2]service[svc1 svc2 svc3]comments[test comment here]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I would like to split the output into individual fields. The values are within square brackets, i.e.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;name&lt;/TD&gt;&lt;TD width="50%"&gt;test 1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;srcintf&lt;/TD&gt;&lt;TD width="50%"&gt;int1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;dstintf&lt;/TD&gt;&lt;TD width="50%"&gt;int2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;...&lt;/TD&gt;&lt;TD width="50%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 17:48:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/580996#M202412</guid>
      <dc:creator>plcd63</dc:creator>
      <dc:date>2022-01-13T17:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: split string with square brackets into individual fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/581007#M202414</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex "name\[(?&amp;lt;name&amp;gt;[^\]]+)]srcintf\[(?&amp;lt;srcintf&amp;gt;[^\]]+)]dstintf\[(?&amp;lt;dstintf&amp;gt;[^\]]+)]srcaddr\[(?&amp;lt;srcaddr&amp;gt;[^\]]+)]dstaddr\[(?&amp;lt;dstaddr&amp;gt;[^\]]+)]service\[(?&amp;lt;service&amp;gt;[^\]]+)]comments\[(?&amp;lt;comments&amp;gt;[^\]]+)]"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 13 Jan 2022 18:42:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/581007#M202414</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-01-13T18:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: split string with square brackets into individual fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/581074#M202439</link>
      <description>&lt;P&gt;Thank you! This works, unless one of the fields is empty, e.g. comments[], which is very likely to happen on some of them, depending on the user input provided.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 10:53:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/581074#M202439</guid>
      <dc:creator>plcd63</dc:creator>
      <dc:date>2022-01-14T10:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: split string with square brackets into individual fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/581075#M202440</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex "name\[(?&amp;lt;name&amp;gt;[^\]]*)]srcintf\[(?&amp;lt;srcintf&amp;gt;[^\]]*)]dstintf\[(?&amp;lt;dstintf&amp;gt;[^\]]*)]srcaddr\[(?&amp;lt;srcaddr&amp;gt;[^\]]*)]dstaddr\[(?&amp;lt;dstaddr&amp;gt;[^\]]*)]service\[(?&amp;lt;service&amp;gt;[^\]]*)]comments\[(?&amp;lt;comments&amp;gt;[^\]]*)]"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 Jan 2022 11:01:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/581075#M202440</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-01-14T11:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: split string with square brackets into individual fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/581117#M202449</link>
      <description>&lt;P&gt;To take this step further, could I also use rex if not every time all of the values are part of the reported field?&lt;/P&gt;&lt;P&gt;e.g. my 1st search might return:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;name[test 1]srcaddr[address1]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;my second search:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;nsrcintf[int1]dstintf[int2]srcaddr[address1]comments[test comment here]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;my third search:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;comments[test comment here]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;etc...&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 15:35:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/581117#M202449</guid>
      <dc:creator>plcd63</dc:creator>
      <dc:date>2022-01-14T15:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: split string with square brackets into individual fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/581123#M202451</link>
      <description>&lt;P&gt;Yes, and sometimes you need to do this if your events don't have all the anchor strings - if this is the case, none of the fields are extracted if you use a single rex string i.e. there has to be a complete match for anything to be extracted. This is useful in some instances and not so much in others, but tbh, it is better this way around in the majority of cases.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 16:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/split-string-with-square-brackets-into-individual-fields/m-p/581123#M202451</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-01-14T16:05:06Z</dc:date>
    </item>
  </channel>
</rss>

