<?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 Multiple key value pairs during search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Multiple-key-value-pairs-during-search/m-p/132204#M36041</link>
    <description>&lt;P&gt;In order to reduce the amount of data being indexed, I am using a sed script to strip away all XML tags and to format the data as &lt;CODE&gt;key=value&lt;/CODE&gt;. Sometimes there are multiple key-value pairs like in the below sample event.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-11-07 03:20:24,637 Outgoing UserId="555555555555" Type="Main" To="user@example.com"  Key="1" Text="Value 1" Key="2" Text="Value 2" Key="3" Text="Value 3" SessionId="1000"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want the search to include all occurrences of multiple key-value pairs (i.e. &lt;CODE&gt;search..| stats count by Key&lt;/CODE&gt;). Currently, I will only get Key=1 in my results. I have added &lt;CODE&gt;MV_ADD&lt;/CODE&gt; to transforms.conf but it is not working. Below is my current configuration.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;props.conf
[source::/path/to/test.txt]
SHOULD_LINEMERGE = False
SEDCMD-trim = s/&amp;lt;([^\s\&amp;gt;]*)[^\&amp;gt;]*\&amp;gt;([^&amp;lt;]*)\&amp;lt;\/\1\&amp;gt;/ \1="\2"/g
REPORT-mvfield = mv-field 

transforms.conf
[mv-field]
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What am I missing?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Based on this &lt;A href="http://answers.splunk.com/answers/24190/multiple-key-value-pair-extraction/" title="Title"&gt;post&lt;/A&gt; I was able to determine that I needed to add a transforms for each field. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mv-field-key]
REGEX = Key=\"(.+?)\"
FORMAT = Key::$1
MV_ADD = true

[mv-field-text]
REGEX = \bText\b=\"(.+?)\"
FORMAT = Text::$1
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is it possible to have a single stanza so that I don't have to specify each field that I want to apply MV_ADD?&lt;/P&gt;</description>
    <pubDate>Thu, 07 Nov 2013 11:47:11 GMT</pubDate>
    <dc:creator>sc0tt</dc:creator>
    <dc:date>2013-11-07T11:47:11Z</dc:date>
    <item>
      <title>Multiple key value pairs during search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multiple-key-value-pairs-during-search/m-p/132204#M36041</link>
      <description>&lt;P&gt;In order to reduce the amount of data being indexed, I am using a sed script to strip away all XML tags and to format the data as &lt;CODE&gt;key=value&lt;/CODE&gt;. Sometimes there are multiple key-value pairs like in the below sample event.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-11-07 03:20:24,637 Outgoing UserId="555555555555" Type="Main" To="user@example.com"  Key="1" Text="Value 1" Key="2" Text="Value 2" Key="3" Text="Value 3" SessionId="1000"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want the search to include all occurrences of multiple key-value pairs (i.e. &lt;CODE&gt;search..| stats count by Key&lt;/CODE&gt;). Currently, I will only get Key=1 in my results. I have added &lt;CODE&gt;MV_ADD&lt;/CODE&gt; to transforms.conf but it is not working. Below is my current configuration.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;props.conf
[source::/path/to/test.txt]
SHOULD_LINEMERGE = False
SEDCMD-trim = s/&amp;lt;([^\s\&amp;gt;]*)[^\&amp;gt;]*\&amp;gt;([^&amp;lt;]*)\&amp;lt;\/\1\&amp;gt;/ \1="\2"/g
REPORT-mvfield = mv-field 

transforms.conf
[mv-field]
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What am I missing?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Based on this &lt;A href="http://answers.splunk.com/answers/24190/multiple-key-value-pair-extraction/" title="Title"&gt;post&lt;/A&gt; I was able to determine that I needed to add a transforms for each field. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mv-field-key]
REGEX = Key=\"(.+?)\"
FORMAT = Key::$1
MV_ADD = true

[mv-field-text]
REGEX = \bText\b=\"(.+?)\"
FORMAT = Text::$1
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is it possible to have a single stanza so that I don't have to specify each field that I want to apply MV_ADD?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2013 11:47:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multiple-key-value-pairs-during-search/m-p/132204#M36041</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-11-07T11:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple key value pairs during search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multiple-key-value-pairs-during-search/m-p/132205#M36042</link>
      <description>&lt;P&gt;Yes, you can do this instead of individual extractions: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mv-field]
REGEX  = (?&amp;lt;_KEY_1&amp;gt;\w+)=\"(?&amp;lt;_VAL_1&amp;gt;.*?)\"
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;_KEY_1&lt;/CODE&gt; and &lt;CODE&gt;_VAL_1&lt;/CODE&gt; have special meanings in transforms.conf&lt;/P&gt;

&lt;P&gt;Edit: Change regexes in the named capture groups to fit your needs.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2013 14:44:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multiple-key-value-pairs-during-search/m-p/132205#M36042</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2013-11-07T14:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple key value pairs during search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multiple-key-value-pairs-during-search/m-p/132206#M36043</link>
      <description>&lt;P&gt;Perfect, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2013 16:16:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multiple-key-value-pairs-during-search/m-p/132206#M36043</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-11-07T16:16:14Z</dc:date>
    </item>
  </channel>
</rss>

