<?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 How to translate mv field extraction from SPL to configuration files? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-translate-mv-field-extraction-from-SPL-to-configuration/m-p/541171#M153197</link>
    <description>&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Situation&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;I am trying to parse events with an unrestricted number of key value pairs&amp;nbsp; that might also include empty values at some places. I would like to extract the part between the closing parenthesis and opening square bracket as the field name without spaces (but don't want them replaced by underscores)&lt;/P&gt;&lt;P&gt;This is an example of such data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2021-02-24 10:02:31 Local0 Info 10:02:31:346 VARC-DCM-01.ad.maastro.nl MAASTRO\VARC-DCM-01$|80012|DICOM Service VARC_DCM_SCP_SVC_Export 021556/Export requested for object with key: (0008,0008) Image Type [DERIVED] | (0008,0016) SOP Class UID [1.2.840.10008.5.1.4.1.1.481.1] | (0008,0022) Acquisition Date [20210223] | (0008,0023) Content Date [20210223] | (0008,0032) Acquisition Time [184740.207] | (0008,0033) Content Time [184740.208] | (0008,1150) Referenced SOP Class UID [1.2.840.10008.5.1.4.1.1.481.5] | (0020,0013) Instance Number [1] | (300C,0002) Referenced RT Plan Sequence [Mergecom.MCitem] | (300C,0006) Referenced Beam Number [1] | (300E,0002) Approval Status []&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Working solution using SPL&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Using this SPL expression (inspired by the example in&amp;nbsp;&lt;A title="Need to split string with variable number of fields" href="https://community.splunk.com/t5/All-Apps-and-Add-ons/Need-to-split-string-with-variable-number-of-fields/m-p/316340" target="_blank" rel="noopener"&gt;this question on multiple field extraction&lt;/A&gt;) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval backup=_raw
| rex max_match=0 mode=sed "s/(?:(?:\s\|)?\s)\((?&amp;lt;g&amp;gt;[\da-fA-F]{4}),(?&amp;lt;e&amp;gt;[\da-fA-F]{4})\)\s+(?&amp;lt;k&amp;gt;(?:\w+(?:\s*))+)\[(?&amp;lt;v&amp;gt;[^\]]*)\]/\3=\"\4\",/g" 
| rex mode=sed "s/\s//g" 
| extract pairdelim=":," kvdelim="="
| rename backup AS _raw&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to translate this to my desired outcome:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Image Type&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;Derived&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;SOP Class UID&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;1.2.840.10008.5.1.4.1.1.481.1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Referenced Beam Number&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Approval Status&lt;/TD&gt;&lt;TD width="50%" height="25px"&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;&lt;STRONG&gt;Example in SPL (for testing)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here is a working example to help with testing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="2021-02-24 10:02:31 Local0 Info 10:02:31:346 VARC-DCM-01.ad.maastro.nl MAASTRO\VARC-DCM-01$|80012|DICOM Service VARC_DCM_SCP_SVC_Export 021556/Export requested for object with key: (0008,0008) Image Type [DERIVED] | (0008,0016) SOP Class UID [1.2.840.10008.5.1.4.1.1.481.1] | (0008,0022) Acquisition Date [20210223] | (0008,0023) Content Date [20210223] | (0008,0032) Acquisition Time [184740.207] | (0008,0033) Content Time [184740.208] | (0008,1150) Referenced SOP Class UID [1.2.840.10008.5.1.4.1.1.481.5] | (0020,0013) Instance Number [1] | (300C,0002) Referenced RT Plan Sequence [Mergecom.MCitem] | (300C,0006) Referenced Beam Number [1] | (300E,0002) Approval Status []"
| eval backup=_raw
| rex max_match=0 mode=sed "s/(?:(?:\s\|)?\s)\((?&amp;lt;g&amp;gt;[\da-fA-F]{4}),(?&amp;lt;e&amp;gt;[\da-fA-F]{4})\)\s+(?&amp;lt;k&amp;gt;(?:\w+(?:\s*))+)\[(?&amp;lt;v&amp;gt;[^\]]*)\]/\3=\"\4\",/g" 
| rex mode=sed "s/\s//g" 
| extract pairdelim=":," kvdelim="="
| rename backup AS _raw&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Question&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Now I would like to transfer this to configuration files but I am unsure what to add where.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I am guessing the regular expression goes in to tokenizer.conf based on &lt;A href="https://community.splunk.com/t5/Getting-Data-In/What-is-the-syntax-for-makemv-delim-quot-quot-when-writing-it-in/m-p/276460" target="_self"&gt;this post&lt;/A&gt;&amp;nbsp;but not sure when combined with the sed command.&lt;/P&gt;&lt;P&gt;Normally SED commands I would put the SED commands into the transforms.conf file but how do I prevent them from applying to all evens? The events like the one processed in the example is only a subset of the events in the index and sourcetypes in there.&lt;BR /&gt;The pairdelim and kvdelim are overrides to the default ones from the sourcetype configuration, not sure where to put this either.&lt;/P&gt;&lt;P&gt;Can someone guide me here? Is there some sort of sequence I can configure like the one in SPL to apply to&amp;nbsp; specific events? How would I go about filtering out these events?&lt;/P&gt;</description>
    <pubDate>Wed, 24 Feb 2021 11:23:38 GMT</pubDate>
    <dc:creator>jmartens</dc:creator>
    <dc:date>2021-02-24T11:23:38Z</dc:date>
    <item>
      <title>How to translate mv field extraction from SPL to configuration files?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-translate-mv-field-extraction-from-SPL-to-configuration/m-p/541171#M153197</link>
      <description>&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Situation&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;I am trying to parse events with an unrestricted number of key value pairs&amp;nbsp; that might also include empty values at some places. I would like to extract the part between the closing parenthesis and opening square bracket as the field name without spaces (but don't want them replaced by underscores)&lt;/P&gt;&lt;P&gt;This is an example of such data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2021-02-24 10:02:31 Local0 Info 10:02:31:346 VARC-DCM-01.ad.maastro.nl MAASTRO\VARC-DCM-01$|80012|DICOM Service VARC_DCM_SCP_SVC_Export 021556/Export requested for object with key: (0008,0008) Image Type [DERIVED] | (0008,0016) SOP Class UID [1.2.840.10008.5.1.4.1.1.481.1] | (0008,0022) Acquisition Date [20210223] | (0008,0023) Content Date [20210223] | (0008,0032) Acquisition Time [184740.207] | (0008,0033) Content Time [184740.208] | (0008,1150) Referenced SOP Class UID [1.2.840.10008.5.1.4.1.1.481.5] | (0020,0013) Instance Number [1] | (300C,0002) Referenced RT Plan Sequence [Mergecom.MCitem] | (300C,0006) Referenced Beam Number [1] | (300E,0002) Approval Status []&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Working solution using SPL&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Using this SPL expression (inspired by the example in&amp;nbsp;&lt;A title="Need to split string with variable number of fields" href="https://community.splunk.com/t5/All-Apps-and-Add-ons/Need-to-split-string-with-variable-number-of-fields/m-p/316340" target="_blank" rel="noopener"&gt;this question on multiple field extraction&lt;/A&gt;) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval backup=_raw
| rex max_match=0 mode=sed "s/(?:(?:\s\|)?\s)\((?&amp;lt;g&amp;gt;[\da-fA-F]{4}),(?&amp;lt;e&amp;gt;[\da-fA-F]{4})\)\s+(?&amp;lt;k&amp;gt;(?:\w+(?:\s*))+)\[(?&amp;lt;v&amp;gt;[^\]]*)\]/\3=\"\4\",/g" 
| rex mode=sed "s/\s//g" 
| extract pairdelim=":," kvdelim="="
| rename backup AS _raw&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to translate this to my desired outcome:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Image Type&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;Derived&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;SOP Class UID&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;1.2.840.10008.5.1.4.1.1.481.1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Referenced Beam Number&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Approval Status&lt;/TD&gt;&lt;TD width="50%" height="25px"&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;&lt;STRONG&gt;Example in SPL (for testing)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here is a working example to help with testing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="2021-02-24 10:02:31 Local0 Info 10:02:31:346 VARC-DCM-01.ad.maastro.nl MAASTRO\VARC-DCM-01$|80012|DICOM Service VARC_DCM_SCP_SVC_Export 021556/Export requested for object with key: (0008,0008) Image Type [DERIVED] | (0008,0016) SOP Class UID [1.2.840.10008.5.1.4.1.1.481.1] | (0008,0022) Acquisition Date [20210223] | (0008,0023) Content Date [20210223] | (0008,0032) Acquisition Time [184740.207] | (0008,0033) Content Time [184740.208] | (0008,1150) Referenced SOP Class UID [1.2.840.10008.5.1.4.1.1.481.5] | (0020,0013) Instance Number [1] | (300C,0002) Referenced RT Plan Sequence [Mergecom.MCitem] | (300C,0006) Referenced Beam Number [1] | (300E,0002) Approval Status []"
| eval backup=_raw
| rex max_match=0 mode=sed "s/(?:(?:\s\|)?\s)\((?&amp;lt;g&amp;gt;[\da-fA-F]{4}),(?&amp;lt;e&amp;gt;[\da-fA-F]{4})\)\s+(?&amp;lt;k&amp;gt;(?:\w+(?:\s*))+)\[(?&amp;lt;v&amp;gt;[^\]]*)\]/\3=\"\4\",/g" 
| rex mode=sed "s/\s//g" 
| extract pairdelim=":," kvdelim="="
| rename backup AS _raw&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Question&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Now I would like to transfer this to configuration files but I am unsure what to add where.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I am guessing the regular expression goes in to tokenizer.conf based on &lt;A href="https://community.splunk.com/t5/Getting-Data-In/What-is-the-syntax-for-makemv-delim-quot-quot-when-writing-it-in/m-p/276460" target="_self"&gt;this post&lt;/A&gt;&amp;nbsp;but not sure when combined with the sed command.&lt;/P&gt;&lt;P&gt;Normally SED commands I would put the SED commands into the transforms.conf file but how do I prevent them from applying to all evens? The events like the one processed in the example is only a subset of the events in the index and sourcetypes in there.&lt;BR /&gt;The pairdelim and kvdelim are overrides to the default ones from the sourcetype configuration, not sure where to put this either.&lt;/P&gt;&lt;P&gt;Can someone guide me here? Is there some sort of sequence I can configure like the one in SPL to apply to&amp;nbsp; specific events? How would I go about filtering out these events?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 11:23:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-translate-mv-field-extraction-from-SPL-to-configuration/m-p/541171#M153197</guid>
      <dc:creator>jmartens</dc:creator>
      <dc:date>2021-02-24T11:23:38Z</dc:date>
    </item>
    <item>
      <title>How to translate mv field extraction from SPL to configuration files?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-translate-mv-field-extraction-from-SPL-to-configuration/m-p/541256#M153242</link>
      <description>&lt;P&gt;Take a look at my response on this post.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/To-Rex-or-not-to-rex/m-p/459516#M129688" target="_blank"&gt;https://community.splunk.com/t5/Splunk-Search/To-Rex-or-not-to-rex/m-p/459516#M129688&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I used this on a source where the Key Value pairs was not consistent.&amp;nbsp; This should allow you to dynamically extract the Key Values from whatever gets&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 18:32:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-translate-mv-field-extraction-from-SPL-to-configuration/m-p/541256#M153242</guid>
      <dc:creator>kmorris_splunk</dc:creator>
      <dc:date>2021-02-24T18:32:03Z</dc:date>
    </item>
  </channel>
</rss>

