<?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: Nested Field Extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Nested-Field-Extraction/m-p/192451#M55337</link>
    <description>&lt;P&gt;After some experimentation I arrived at a solution:&lt;BR /&gt;&lt;BR /&gt;
(?&amp;lt; combined_field&amp;gt;(?&amp;lt; src_zone&amp;gt;\d+\w+)[\-](?&amp;lt; dst_zone&amp;gt;[^\t]+))\t+  &lt;/P&gt;

&lt;P&gt;Yielded the desired results:&lt;BR /&gt;&lt;BR /&gt;
combined_field = "1A-1B"&lt;BR /&gt;&lt;BR /&gt;
src_zone = "1A"&lt;BR /&gt;&lt;BR /&gt;
dst_zone = "1B"&lt;/P&gt;

&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Mar 2014 16:59:00 GMT</pubDate>
    <dc:creator>psharkey</dc:creator>
    <dc:date>2014-03-18T16:59:00Z</dc:date>
    <item>
      <title>Nested Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nested-Field-Extraction/m-p/192448#M55334</link>
      <description>&lt;P&gt;I have extracted a field that contains two values separated by a dash character "-". Now I want to retain that field/value as well as splitting its value into two additional fields.&lt;/P&gt;

&lt;P&gt;For example:&lt;BR /&gt;&lt;BR /&gt;
combined_field = "1A-1B"  (or src_zone-dst_zone)&lt;BR /&gt;&lt;BR /&gt;
src_zone = "1A" (one or more numbers followed by a single letter)&lt;BR /&gt;&lt;BR /&gt;
dst_zone = "1B" (one or more numbers followed by a single letter)  &lt;/P&gt;

&lt;P&gt;This rex worked (?&amp;lt; combined_field&amp;gt;[^\t]+) for capturing combined_field = "1A-1B".&lt;BR /&gt;&lt;BR /&gt;
(fields are tab separated)&lt;/P&gt;

&lt;P&gt;This rex worked (?&amp;lt; combined_field&amp;gt;(?&amp;lt; src_zone&amp;gt;\d+\w+)[^\t]+) for capturing both combined_field = "1A-1B" and src_zone = "1A".  &lt;/P&gt;

&lt;P&gt;However, this rex (?&amp;lt; combined_field&amp;gt;(?&amp;lt; src_zone&amp;gt;\d+\w+)[\-](?&amp;lt; dst_zone&amp;gt;\d+\w+)[^\t]+) fails to capture src_zone or dst_zone.&lt;/P&gt;

&lt;P&gt;How can I revise this rex to capture the combined_field in its entirety, src_zone and dst_zone?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Patrick&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2014 15:17:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nested-Field-Extraction/m-p/192448#M55334</guid>
      <dc:creator>psharkey</dc:creator>
      <dc:date>2014-03-18T15:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nested-Field-Extraction/m-p/192449#M55335</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search  | rex field=yourfield "(?&amp;lt;combined&amp;gt;(?&amp;lt;src_zone&amp;gt;.*)[\-](?&amp;lt;dst_zone&amp;gt;[^t]+))"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you're not keen on doing everything in one rex command only, there are multiple options.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search  | rex field=yourfield "(?&amp;lt;combined_field&amp;gt;[^t]+)" | rex field=combined_field  "(?&amp;lt;src_zone&amp;gt;.*)[\-](?&amp;lt;dst_zone&amp;gt;.*)"


 your base search  | rex field=yourfield "(?&amp;lt;src_zone&amp;gt;.*)[\-](?&amp;lt;dst_zone&amp;gt;.*)[t]+" | eval combined_field= src_zone."-".dst_zone
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Mar 2014 15:35:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nested-Field-Extraction/m-p/192449#M55335</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-03-18T15:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nested-Field-Extraction/m-p/192450#M55336</link>
      <description>&lt;P&gt;I should have specified that there are additional tab separated fields after combined_field. When I attempted your first suggestion it captured more than I wanted.  &lt;/P&gt;

&lt;P&gt;However, I am getting closer using a variation on your first suggestion:   &lt;/P&gt;

&lt;P&gt;(?&amp;lt; combined_field&amp;gt;(?&amp;lt; src_zone&amp;gt;\d+\w+)[\-](?&amp;lt; dst_zone&amp;gt;[^\t]))[^\t]+  &lt;/P&gt;

&lt;P&gt;yields&lt;BR /&gt;&lt;BR /&gt;
combined_field = "1A-1"&lt;BR /&gt;&lt;BR /&gt;
src_zone = "1A"&lt;BR /&gt;&lt;BR /&gt;
dst_zone = "1"  &lt;/P&gt;

&lt;P&gt;combined_field and dst_zone are getting clipped by one character.  &lt;/P&gt;

&lt;P&gt;Any more suggestions?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2014 16:00:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nested-Field-Extraction/m-p/192450#M55336</guid>
      <dc:creator>psharkey</dc:creator>
      <dc:date>2014-03-18T16:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nested-Field-Extraction/m-p/192451#M55337</link>
      <description>&lt;P&gt;After some experimentation I arrived at a solution:&lt;BR /&gt;&lt;BR /&gt;
(?&amp;lt; combined_field&amp;gt;(?&amp;lt; src_zone&amp;gt;\d+\w+)[\-](?&amp;lt; dst_zone&amp;gt;[^\t]+))\t+  &lt;/P&gt;

&lt;P&gt;Yielded the desired results:&lt;BR /&gt;&lt;BR /&gt;
combined_field = "1A-1B"&lt;BR /&gt;&lt;BR /&gt;
src_zone = "1A"&lt;BR /&gt;&lt;BR /&gt;
dst_zone = "1B"&lt;/P&gt;

&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2014 16:59:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nested-Field-Extraction/m-p/192451#M55337</guid>
      <dc:creator>psharkey</dc:creator>
      <dc:date>2014-03-18T16:59:00Z</dc:date>
    </item>
  </channel>
</rss>

