<?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: Need advice on a complex field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264397#M79369</link>
    <description>&lt;P&gt;The above is assuming you &lt;STRONG&gt;do not&lt;/STRONG&gt; want to keep the surrounding " 's&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2016 19:30:12 GMT</pubDate>
    <dc:creator>adamsaul</dc:creator>
    <dc:date>2016-10-18T19:30:12Z</dc:date>
    <item>
      <title>Need advice on a complex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264395#M79367</link>
      <description>&lt;P&gt;I have some data which are of the following format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CommonPrefix.1.name="Field1",CommonPrefix.1.type="STRING",CommonPrefix.1.status="alive",CommonPrefix.2.name="Field2",CommonPrefix.2.type="NUMBER",CommonPrefix.2.value="3",CommonPrefix.2.status="seen"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;etc. I would like to extract some fields so that &lt;CODE&gt;name&lt;/CODE&gt; above will become a field name and &lt;CODE&gt;status&lt;/CODE&gt; will become a value. So the data above would yield two extra fields: &lt;CODE&gt;Field1=alive&lt;/CODE&gt; and &lt;CODE&gt;Field2=seen&lt;/CODE&gt;. I know that those numbers always go from 1 to 7, and that &lt;CODE&gt;.name&lt;/CODE&gt; always precedes &lt;CODE&gt;.status&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I tried to make a transform like this:&lt;BR /&gt;
In &lt;CODE&gt;props.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[MySourceType]
TRANSFORMS-myfield1 = transformed_1
...
TRANSFORMS-myfield7 = transformed_7
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and in &lt;CODE&gt;transforms.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[transformed_1]
REGEX = CommonPrefix\.1\.name=”([^”]*)”.*CommonPrefix\.1\.status=”([^”]*)”
FORMAT = $1::$2
LOOKAHEAD= 1048576
...
[transformed_7]
REGEX = CommonPrefix\.7\.name=”([^”]*)”.*CommonPrefix\.7\.status=”([^”]*)”
FORMAT = $1::$2
LOOKAHEAD= 1048576
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm using LOOKAHEAD because my data are quite long. I tried to use _KEY_1 + _VAL_1 capturing groups as well, instead of or in addition to FORMAT. Nothing worked - the fields are not extracted.&lt;/P&gt;

&lt;P&gt;Any ideas on what to fix here?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:29:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264395#M79367</guid>
      <dc:creator>arkadyz1</dc:creator>
      <dc:date>2020-09-29T11:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need advice on a complex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264396#M79368</link>
      <description>&lt;P&gt;arkadyz1,&lt;/P&gt;

&lt;P&gt;Try this reg-ex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?:CommonPrefix\.1\.name=\")(\w*)(?:\")(?:.*)(?:CommonPrefix\.1\.status=\")(\w*)(?:\")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Oct 2016 19:27:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264396#M79368</guid>
      <dc:creator>adamsaul</dc:creator>
      <dc:date>2016-10-18T19:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need advice on a complex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264397#M79369</link>
      <description>&lt;P&gt;The above is assuming you &lt;STRONG&gt;do not&lt;/STRONG&gt; want to keep the surrounding " 's&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 19:30:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264397#M79369</guid>
      <dc:creator>adamsaul</dc:creator>
      <dc:date>2016-10-18T19:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need advice on a complex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264398#M79370</link>
      <description>&lt;P&gt;Hi arkadyz1,&lt;/P&gt;

&lt;P&gt;Your regex would work! But you have a format issue; your double quotes are &lt;CODE&gt;windownized&lt;/CODE&gt; and therefore wrong &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;This is working:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; CommonPrefix\.1\.name="([^"]*)".*CommonPrefix\.1\.status="([^"]*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;This is not working:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; CommonPrefix\.1\.name=”([^”]*)”.*CommonPrefix\.1\.status=”([^”]*)”
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 20:01:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264398#M79370</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-10-18T20:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Need advice on a complex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264399#M79371</link>
      <description>&lt;P&gt;The quotes are fine in transforms.conf, it's just this site that windownized them. So no, it's not that. I tried escaping them with backslashes, which also didn't work.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 20:52:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264399#M79371</guid>
      <dc:creator>arkadyz1</dc:creator>
      <dc:date>2016-10-18T20:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need advice on a complex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264400#M79372</link>
      <description>&lt;P&gt;Your regex works on your provided sample event see &lt;A href="http://pasteboard.co/gzVlDIRjH.png"&gt;http://pasteboard.co/gzVlDIRjH.png&lt;/A&gt; :&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://pasteboard.co/gzVlDIRjH.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Make sure your &lt;CODE&gt;sourcetype&lt;/CODE&gt; matches, you placed the &lt;CODE&gt;props.conf&lt;/CODE&gt; on the parsing Splunk instance and restarted splunk afterwards.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 20:59:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264400#M79372</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-10-18T20:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need advice on a complex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264401#M79373</link>
      <description>&lt;P&gt;I'm not sure why adding capturing groups worked, but it did. Really weird...&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 21:17:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264401#M79373</guid>
      <dc:creator>arkadyz1</dc:creator>
      <dc:date>2016-10-18T21:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need advice on a complex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264402#M79374</link>
      <description>&lt;P&gt;I added capturing groups as suggested by adamsaul in the accepted answer and it started working. I also escaped double quotes with backslashes but I tried that before. Really strange...&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 21:19:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264402#M79374</guid>
      <dc:creator>arkadyz1</dc:creator>
      <dc:date>2016-10-18T21:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need advice on a complex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264403#M79375</link>
      <description>&lt;P&gt;Technically you have capturing groups as well, but I also used non-capturing groups so that Splunk doesn't interpret any other data (not that it should).&lt;/P&gt;

&lt;P&gt;Glad it worked for you!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 21:20:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264403#M79375</guid>
      <dc:creator>adamsaul</dc:creator>
      <dc:date>2016-10-18T21:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need advice on a complex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264404#M79376</link>
      <description>&lt;P&gt;Of course &lt;EM&gt;facepalm&lt;/EM&gt; - good spotting in this case! &lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 21:20:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-advice-on-a-complex-field-extraction/m-p/264404#M79376</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-10-18T21:20:12Z</dc:date>
    </item>
  </channel>
</rss>

