<?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 a merge value and a field name from two multi value fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371736#M109376</link>
    <description>&lt;P&gt;Hello, I have a Field with  Oracle SQL_BIND and a second field with the SQL_TEXT, the SQL_BIND contains the values while the SQL_TEXT contains de fields name&lt;/P&gt;

&lt;P&gt;They look like: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SQL_BIND=" #1(7):3077144 #2(1):0 #3(3):100 #4(5):10113 #5(4):2529 #6(1):0 #7(5):40001 #8(5):57195 #9(5):80263 #10(5):10113 #11(1):0 #12(4):4752 #13(1):3 #14(1):5 #15(1):1 #16(15):3/31/2018... etc
SQL_TEXT="INSERT INTO psm.camio_in (numero_sistema, numero_romaneo, cod_operacion, cliente, procedencia, subprocedencia, corredor, cargador, entregador, remitente, cod_acopio_client, cod_transportista,... etc..
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to get KV the pairs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;numero_sistema=3077144
numero_romaneo=0
cod_operacion=100
cliente=10113
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.... etc&lt;/P&gt;

&lt;P&gt;I had tried to find the right way to do this but I was not able:&lt;BR /&gt;
Any ideas?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 19:19:19 GMT</pubDate>
    <dc:creator>hugohctint</dc:creator>
    <dc:date>2020-09-29T19:19:19Z</dc:date>
    <item>
      <title>How to a merge value and a field name from two multi value fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371736#M109376</link>
      <description>&lt;P&gt;Hello, I have a Field with  Oracle SQL_BIND and a second field with the SQL_TEXT, the SQL_BIND contains the values while the SQL_TEXT contains de fields name&lt;/P&gt;

&lt;P&gt;They look like: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SQL_BIND=" #1(7):3077144 #2(1):0 #3(3):100 #4(5):10113 #5(4):2529 #6(1):0 #7(5):40001 #8(5):57195 #9(5):80263 #10(5):10113 #11(1):0 #12(4):4752 #13(1):3 #14(1):5 #15(1):1 #16(15):3/31/2018... etc
SQL_TEXT="INSERT INTO psm.camio_in (numero_sistema, numero_romaneo, cod_operacion, cliente, procedencia, subprocedencia, corredor, cargador, entregador, remitente, cod_acopio_client, cod_transportista,... etc..
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to get KV the pairs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;numero_sistema=3077144
numero_romaneo=0
cod_operacion=100
cliente=10113
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.... etc&lt;/P&gt;

&lt;P&gt;I had tried to find the right way to do this but I was not able:&lt;BR /&gt;
Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:19:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371736#M109376</guid>
      <dc:creator>hugohctint</dc:creator>
      <dc:date>2020-09-29T19:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to a merge value and a field name from two multi value fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371737#M109377</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval _raw="SQL_BIND=\" #1(7):3077144 #2(1):0 #3(3):100 #4(5):10113 #5(4):2529 #6(1):0 #7(5):40001 #8(5):57195 #9(5):80263 #10(5):10113 #11(1):0 #12(4):4752... etc\"
 SQL_TEXT=\"INSERT INTO psm.camio_in (numero_sistema, numero_romaneo, cod_operacion, cliente, procedencia, subprocedencia, corredor, cargador, entregador, remitente, cod_acopio_client, cod_transportista,... etc..)\"" | table _raw 
| rename COMMENT as "Above lines are to generate sample data with 12 fields"
| rex "SQL_BIND\=\"(?&amp;lt;SQL_BIND&amp;gt;[^\"]+)" | rex "SQL_TEXT\=\"[^\(]+\((?&amp;lt;SQL_TEXT&amp;gt;[^\)]+)" 
| rename COMMENT as "Above line extract the relevant portion for SQL_BIND and SQL_TEXT from raw data"
| makemv SQL_TEXT delim=", " | rex max_match=0 field=SQL_BIND "#\d+\((?&amp;lt;SQL_BIND&amp;gt;[^\)]+)" 
| rename COMMENT as "Above line converts both to multivalued field"
| eval temp=mvzip(SQL_TEXT,SQL_BIND,"#") | mvexpand temp | rex field=temp "(?&amp;lt;SQL_TEXT&amp;gt;[^#]+)#(?&amp;lt;SQL_BIND&amp;gt;.+)" | table SQL_TEXT SQL_BIND
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Apr 2018 21:12:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371737#M109377</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-04-30T21:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to a merge value and a field name from two multi value fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371738#M109378</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval SQL_BIND="#1(7):3077144 #2(1):0 #3(3):100 #4(5):10113 #5(4):2529 #6(1):0 #7(5):40001 #8(5):57195 #9(5):80263 #10(5):10113 #11(1):0 #12(4):4752", SQL_TEXT="INSERT INTO psm.camio_in (numero_sistema, numero_romaneo, cod_operacion, cliente, procedencia, subprocedencia, corredor, cargador, entregador, remitente, cod_acopio_client, cod_transportista)"

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| rex max_match=0 field=SQL_BIND "#\d+\(\d+\):(?&amp;lt;MV_SQL_BIND&amp;gt;\S+)"
| eval MV_SQL_TEXT=SQL_TEXT
| rex field=MV_SQL_TEXT mode=sed "s/^[^\(]+\(// s/\).*$//"
| eval MV_SQL_TEXT=split(MV_SQL_TEXT, ", ")
| eval _raw=mvzip(MV_SQL_TEXT, MV_SQL_BIND, "=")
| fields - MV_SQL_TEXT MV_SQL_BIND
| kv
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 May 2018 16:21:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371738#M109378</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-01T16:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to a merge value and a field name from two multi value fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371739#M109379</link>
      <description>&lt;P&gt;This answer preserves the original number of events and all context (except for &lt;CODE&gt;_raw&lt;/CODE&gt;, which should not be important, but you can add an &lt;CODE&gt;eval orig_raw = _raw&lt;/CODE&gt; if you need to).&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 16:26:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371739#M109379</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-01T16:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to a merge value and a field name from two multi value fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371740#M109380</link>
      <description>&lt;P&gt;This approach is very good, thank you. What is the best way to incorporate this new individual fields to the event/index?&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 17:23:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371740#M109380</guid>
      <dc:creator>hugohctint</dc:creator>
      <dc:date>2018-05-01T17:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to a merge value and a field name from two multi value fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371741#M109381</link>
      <description>&lt;P&gt;I do not understand the question; please rephrase and expand it.&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 18:19:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371741#M109381</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-01T18:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to a merge value and a field name from two multi value fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371742#M109382</link>
      <description>&lt;P&gt;What I am trying to say is how to incorporate all these new variables into the index or sourcetype as permanent and also add the transformation to the data coming in. &lt;BR /&gt;
Is that more clear?&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 18:27:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371742#M109382</guid>
      <dc:creator>hugohctint</dc:creator>
      <dc:date>2018-05-01T18:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to a merge value and a field name from two multi value fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371743#M109383</link>
      <description>&lt;P&gt;Ah, I see.  Unfortunately, I do not see how this can be done.  The principle problem is that there is no automatic way to do &lt;CODE&gt;mvzip&lt;/CODE&gt;, which is a critical step in the solution set.&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 18:42:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/371743#M109383</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-01T18:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to a merge value and a field name from two multi value fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/514573#M144434</link>
      <description>&lt;P&gt;this had my hopes up while I used it to fit my use case. Came back and saw the rest of the thread.&amp;nbsp; Slowly dying inside.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 19:30:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/514573#M144434</guid>
      <dc:creator>skyelowryvancit</dc:creator>
      <dc:date>2020-08-19T19:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to a merge value and a field name from two multi value fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/514578#M144435</link>
      <description>&lt;P&gt;Why don't you create transforms.conf?&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/203761"&gt;@skyelowryvancit&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 02:36:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-a-merge-value-and-a-field-name-from-two-multi-value/m-p/514578#M144435</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-08-18T02:36:45Z</dc:date>
    </item>
  </channel>
</rss>

