<?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: How to extract key/value with dynamic key name? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618524#M214983</link>
    <description>&lt;P&gt;Wow. I had no idea that was a thing! It never crossed my mind.&lt;/P&gt;&lt;P&gt;It wont work in this situation, as I use it to keep track of forwarders and stuff rest wouldn't have access to, but that is fascinating. Might be worth writing my own script to push out instead of the btool app...&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is one of my input stanzas:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[script:///opt/splunk/etc/apps/btool/bin/btool.sh transforms /opt/splunk]                           _rcvbuf = 1572864                          
disabled = 0
host = cn02-k
index = splunk_insights
interval = 43200
sourcetype = splunk:config:btool:transforms&lt;/LI-CODE&gt;&lt;P&gt;And I know my existing props works, because the rest of my stanza has been working:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[(?::){0}splunk:config:btool:*]
TRUNCATE=10000
MAX_EVENTS=10000
KV_MODE = none
BREAK_ONLY_BEFORE = conf[\s]+\[
REPORT-dotheparsething = dotheparsething    &amp;lt;-----except this critter.&lt;/LI-CODE&gt;&lt;P&gt;By "getting nothing", I mean that I was expecting my regex to go through and convert the output in the first post to key/value pairs when I search. I have this running on a single instance of splunk, so there's no search head/indexer confusions. So, given:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/opt/splunk/etc/apps/Splunk_TA_windows/default/transforms.conf                               [xmlsecurity_eventcode_errorcode_action_lookup]
/opt/splunk/etc/system/default/transforms.conf                                               CAN_OPTIMIZE = True
/opt/splunk/etc/system/default/transforms.conf                                               CLEAN_KEYS = True
/opt/splunk/etc/system/default/transforms.conf                                               DEFAULT_VALUE = 
/opt/splunk/etc/system/default/transforms.conf                                               DEPTH_LIMIT = 1000
/opt/splunk/etc/system/default/transforms.conf                                               DEST_KEY = 
/opt/splunk/etc/system/default/transforms.conf                                               FORMAT = 
/opt/splunk/etc/system/default/transforms.conf                                               KEEP_EMPTY_VALS = False&lt;/LI-CODE&gt;&lt;P&gt;I am hoping to get&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Match - $1	CAN_OPTIMIZE	
Match - $2	TRUE	
Match - $1	CLEAN_KEYS	
Match - $2	TRUE	
Match - $1	DEPTH_LIMIT	
Match - $2	1000	
Match - $1	KEEP_EMPTY_VALS	
Match - $2	FALSE	
		
Key=Value --&amp;gt;  $1::$2
		
CAN_OPTIMIZE	 =	TRUE
CLEAN_KEYS	 =	TRUE
DEPTH_LIMIT	 =	1000
KEEP_EMPTY_VALS	 =	FALSE&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 27 Oct 2022 05:42:52 GMT</pubDate>
    <dc:creator>oliverja</dc:creator>
    <dc:date>2022-10-27T05:42:52Z</dc:date>
    <item>
      <title>How to extract key/value with dynamic key name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618364#M214913</link>
      <description>&lt;P&gt;I found &lt;A href="https://community.splunk.com/t5/Getting-Data-In/Automatic-field-discovery-key-value-pairs-with/m-p/484336#M82969" target="_self"&gt;this&lt;/A&gt;, but I am unable to replicate it.&lt;/P&gt;
&lt;P&gt;I am not understanding where I am messing up here.&lt;/P&gt;
&lt;P&gt;Problem:&lt;/P&gt;
&lt;P&gt;I feed btool outputs into splunk, and chop them up by stanza.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;/opt/splunk/etc/apps/Splunk_TA_windows/default/transforms.conf                               [xmlsecurity_eventcode_errorcode_action_lookup]
/opt/splunk/etc/system/default/transforms.conf                                               CAN_OPTIMIZE = True
/opt/splunk/etc/system/default/transforms.conf                                               CLEAN_KEYS = True
/opt/splunk/etc/system/default/transforms.conf                                               DEFAULT_VALUE = 
/opt/splunk/etc/system/default/transforms.conf                                               DEPTH_LIMIT = 1000
/opt/splunk/etc/system/default/transforms.conf                                               DEST_KEY = 
/opt/splunk/etc/system/default/transforms.conf                                               FORMAT = 
/opt/splunk/etc/system/default/transforms.conf                                               KEEP_EMPTY_VALS = False
/opt/splunk/etc/system/default/transforms.conf                                               LOOKAHEAD = 4096
/opt/splunk/etc/system/default/transforms.conf                                               MATCH_LIMIT = 100000
/opt/splunk/etc/system/default/transforms.conf                                               MV_ADD = False
/opt/splunk/etc/system/default/transforms.conf                                               REGEX = 
/opt/splunk/etc/system/default/transforms.conf                                               SOURCE_KEY = _raw
/opt/splunk/etc/system/default/transforms.conf                                               WRITE_META = False
/opt/splunk/etc/apps/Splunk_TA_windows/default/transforms.conf                               case_sensitive_match = false
/opt/splunk/etc/apps/Splunk_TA_windows/default/transforms.conf                               filename = xmlsecurity_eventcode_errorcode_action.csv&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I then wanted to extract the fields, for example "SOURCE_KEY = _raw" should be my key/value pair!&lt;/P&gt;
&lt;P&gt;I hoped to accomplish this with&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(transforms)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[dotheparsething]
REGEX = \s([\S-]+)\s=\s([^\/\n]+)
LOOKAHEAD = 100000
FORMAT = $1::$2
REPEAT_MATCH = true&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(props)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[(?::){0}splunk:config:btool:*]
TRUNCATE=10000
MAX_EVENTS=10000
KV_MODE = none
BREAK_ONLY_BEFORE = conf[\s]+\[
#SEDCMD-removespaces = s/\ +/\ /g
REPORT-dotheparsething = dotheparsething&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;But I am getting nothing!&lt;/P&gt;
&lt;P&gt;Regex101 seems happy with my search.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 14:09:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618364#M214913</guid>
      <dc:creator>oliverja</dc:creator>
      <dc:date>2022-10-26T14:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key/value with dynamic key name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618467#M214960</link>
      <description>&lt;P&gt;Did you know btool-equivalent data is available via REST?&amp;nbsp; Check out&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rest /services/configs/conf-&amp;lt;&amp;lt;conf&amp;gt;&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where &amp;lt;&amp;lt;conf&amp;gt;&amp;gt; is a config file name (props, transforms, etc.).&lt;/P&gt;&lt;P&gt;When you say you are getting nothing, what exactly does that mean?&amp;nbsp; How are you looking for the something?&amp;nbsp; Recall the REPORT settings extract fields at search time as opposed to TRANSFORMS settings which apply at index time.&lt;/P&gt;&lt;P&gt;What sourcetype is specified in your inputs.conf?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 20:59:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618467#M214960</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-10-26T20:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key/value with dynamic key name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618524#M214983</link>
      <description>&lt;P&gt;Wow. I had no idea that was a thing! It never crossed my mind.&lt;/P&gt;&lt;P&gt;It wont work in this situation, as I use it to keep track of forwarders and stuff rest wouldn't have access to, but that is fascinating. Might be worth writing my own script to push out instead of the btool app...&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is one of my input stanzas:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[script:///opt/splunk/etc/apps/btool/bin/btool.sh transforms /opt/splunk]                           _rcvbuf = 1572864                          
disabled = 0
host = cn02-k
index = splunk_insights
interval = 43200
sourcetype = splunk:config:btool:transforms&lt;/LI-CODE&gt;&lt;P&gt;And I know my existing props works, because the rest of my stanza has been working:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[(?::){0}splunk:config:btool:*]
TRUNCATE=10000
MAX_EVENTS=10000
KV_MODE = none
BREAK_ONLY_BEFORE = conf[\s]+\[
REPORT-dotheparsething = dotheparsething    &amp;lt;-----except this critter.&lt;/LI-CODE&gt;&lt;P&gt;By "getting nothing", I mean that I was expecting my regex to go through and convert the output in the first post to key/value pairs when I search. I have this running on a single instance of splunk, so there's no search head/indexer confusions. So, given:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/opt/splunk/etc/apps/Splunk_TA_windows/default/transforms.conf                               [xmlsecurity_eventcode_errorcode_action_lookup]
/opt/splunk/etc/system/default/transforms.conf                                               CAN_OPTIMIZE = True
/opt/splunk/etc/system/default/transforms.conf                                               CLEAN_KEYS = True
/opt/splunk/etc/system/default/transforms.conf                                               DEFAULT_VALUE = 
/opt/splunk/etc/system/default/transforms.conf                                               DEPTH_LIMIT = 1000
/opt/splunk/etc/system/default/transforms.conf                                               DEST_KEY = 
/opt/splunk/etc/system/default/transforms.conf                                               FORMAT = 
/opt/splunk/etc/system/default/transforms.conf                                               KEEP_EMPTY_VALS = False&lt;/LI-CODE&gt;&lt;P&gt;I am hoping to get&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Match - $1	CAN_OPTIMIZE	
Match - $2	TRUE	
Match - $1	CLEAN_KEYS	
Match - $2	TRUE	
Match - $1	DEPTH_LIMIT	
Match - $2	1000	
Match - $1	KEEP_EMPTY_VALS	
Match - $2	FALSE	
		
Key=Value --&amp;gt;  $1::$2
		
CAN_OPTIMIZE	 =	TRUE
CLEAN_KEYS	 =	TRUE
DEPTH_LIMIT	 =	1000
KEEP_EMPTY_VALS	 =	FALSE&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 27 Oct 2022 05:42:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618524#M214983</guid>
      <dc:creator>oliverja</dc:creator>
      <dc:date>2022-10-27T05:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key/value with dynamic key name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618600#M215013</link>
      <description>&lt;P&gt;I was able to get it to work by removing the regex from the stanza name in props.conf.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[splunk:config:btool:*]
TRUNCATE=10000
MAX_EVENTS=10000
KV_MODE = none
BREAK_ONLY_BEFORE = conf[\s]+\[
REPORT-dotheparsething = dotheparsething
DATETIME_CONFIG = current&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 27 Oct 2022 15:15:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618600#M215013</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-10-27T15:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key/value with dynamic key name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618692#M215031</link>
      <description>&lt;P&gt;No, changing the regex just kills the whole stanza, because there's no wildcards in sourcetypes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When my "break only before" is removed, each line is a new event, and splunk auto extracts the single fields.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="oliverja_0-1666938600268.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22199i7010D272AB850722/image-size/medium?v=v2&amp;amp;px=400" role="button" title="oliverja_0-1666938600268.png" alt="oliverja_0-1666938600268.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want the exact same extractions, but with the whole stanza as a single event&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="oliverja_1-1666938650917.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22200i3987D3A7BB0677CD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="oliverja_1-1666938650917.png" alt="oliverja_1-1666938650917.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 06:31:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618692#M215031</guid>
      <dc:creator>oliverja</dc:creator>
      <dc:date>2022-10-28T06:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key/value with dynamic key name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618721#M215043</link>
      <description>&lt;P&gt;Perhaps it's a version thing, but it works in 9.0.0.1.&amp;nbsp; Sourcetype splunk:config:btool:transforms was parsed from stanza [splunk:config:btool:*].&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="richgalloway_0-1666960356233.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22202iB37C4E36670C7B8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="richgalloway_0-1666960356233.png" alt="richgalloway_0-1666960356233.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 12:45:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-with-dynamic-key-name/m-p/618721#M215043</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-10-28T12:45:38Z</dc:date>
    </item>
  </channel>
</rss>

