<?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: Create new fields using values from another field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750237#M242279</link>
    <description>&lt;P&gt;This looks very promising. Thank you for your valued input!&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jul 2025 11:14:49 GMT</pubDate>
    <dc:creator>bt149</dc:creator>
    <dc:date>2025-07-22T11:14:49Z</dc:date>
    <item>
      <title>Create new fields using values from another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750174#M242270</link>
      <description>&lt;P&gt;I have a field called key. key has multivalues that are also dynamic. I have another field called values, that is also multivalued and dynamic. The values in "values" line-up with the values in "key".&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;TABLE width="833"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="96"&gt;key&lt;/TD&gt;&lt;TD width="737"&gt;values&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;AdditionalInfo&lt;/TD&gt;&lt;TD&gt;user has removed device with id alpha_numeric_field" in area "alpha_numeric_field" for user "alpha_numeric_field".&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;DeviceID&lt;/TD&gt;&lt;TD&gt;alpha_numeric_field&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;DeviceType&lt;/TD&gt;&lt;TD&gt;mobile_device&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OS&lt;/TD&gt;&lt;TD&gt;Windows&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance and I hope this makes sense.&lt;BR /&gt;&lt;BR /&gt;I want to create a new field using the values from the field "key" and have the values be the values from "values".&lt;BR /&gt;The oucome would be:&lt;/P&gt;&lt;TABLE width="830px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="111.984px"&gt;AdditionalInfo&lt;/TD&gt;&lt;TD width="717.016px"&gt;user has removed device with id alpha_numeric_field" in area "alpha_numeric_field" for user "alpha_numeric_field".&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="111.984px"&gt;DeviceID&lt;/TD&gt;&lt;TD width="717.016px"&gt;alpha_numeric_field&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="111.984px"&gt;DeviceType&lt;/TD&gt;&lt;TD width="717.016px"&gt;mobile_device&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="111.984px"&gt;OS&lt;/TD&gt;&lt;TD width="717.016px"&gt;Windows&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 21 Jul 2025 14:59:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750174#M242270</guid>
      <dc:creator>bt149</dc:creator>
      <dc:date>2025-07-21T14:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create new fields using values from another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750178#M242271</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/242392"&gt;@bt149&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kiran_panchavat_0-1753111038556.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/39702iB21E71051B57876A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kiran_panchavat_0-1753111038556.png" alt="kiran_panchavat_0-1753111038556.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2025 15:18:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750178#M242271</guid>
      <dc:creator>kiran_panchavat</dc:creator>
      <dc:date>2025-07-21T15:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Create new fields using values from another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750180#M242272</link>
      <description>&lt;P&gt;I appreciate the help, but this is not what I'm looking to do. I want to create the new fields so they could be used for searching. I already have a field using the mvzip command. Thanks again.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2025 15:30:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750180#M242272</guid>
      <dc:creator>bt149</dc:creator>
      <dc:date>2025-07-21T15:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Create new fields using values from another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750199#M242274</link>
      <description>&lt;P&gt;For creating fields dynamicaly you can use the {} syntax. Like&lt;/P&gt;&lt;PRE&gt;| makeresults&lt;BR /&gt;| eval field="field1",{field}="value"&lt;/PRE&gt;&lt;P&gt;But the important question and a possible issue here is where did you get the multivalued fields from. Remember that two distinct multivalued fields are... well, distinct. There is no relationship between their values whatsoever. And if you are creating multivalued field by means of list() or values() and the original data didn't have some values, you can't tel, which ones were empty. You're just getting a "squashed" list as a result.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2025 20:02:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750199#M242274</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-07-21T20:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Create new fields using values from another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750216#M242278</link>
      <description>&lt;P&gt;First, I suspect that you meant the input looks like&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;key&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;values&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;AdditionalInfo&lt;/DIV&gt;&lt;DIV class=""&gt;DeviceID&lt;/DIV&gt;&lt;DIV class=""&gt;DeviceType&lt;/DIV&gt;&lt;DIV class=""&gt;OS&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;user has removed device with id "alpha_numeric_field" in area "alpha_numeric_field" for user "alpha_numeric_field".&lt;/DIV&gt;&lt;DIV class=""&gt;alpha_numeric_field&lt;/DIV&gt;&lt;DIV class=""&gt;mobile_device&lt;/DIV&gt;&lt;DIV class=""&gt;Windows&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Second, I have a question about the origin of "key" and "values". &amp;nbsp;Could they come from a structure such as JSON? &amp;nbsp;Maybe there is a better opportunity than at the end of processing.&lt;/P&gt;&lt;P&gt;Third, I suspect that you meant "the output would be"&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;AdditionalInfo&lt;/TD&gt;&lt;TD&gt;DeviceID&lt;/TD&gt;&lt;TD&gt;DeviceType&lt;/TD&gt;&lt;TD&gt;OS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;user has removed device with id "alpha_numeric_field" in area "alpha_numeric_field" for user "alpha_numeric_field".&lt;/TD&gt;&lt;TD&gt;alpha_numeric_field&lt;/TD&gt;&lt;TD&gt;mobile_device&lt;/TD&gt;&lt;TD&gt;Windows&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally, if your Splunk is 8.1 or later, you can use JSON functions and the multivalue mode of foreach to do the job:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval idx = mvrange(0, mvcount(key))
| eval keyvalue = json_object()
| foreach idx mode=multivalue
    [eval keyvalue = json_set(keyvalue, mvindex(key, &amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;), mvindex(values, &amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;))]
| spath input=keyvalue
| fields - idx key values keyvalue&lt;/LI-CODE&gt;&lt;P&gt;Here is an emulation for you to play with and compare with real data&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="key,values
AdditionalInfo,user has removed device with id \"alpha_numeric_field\" in area \"alpha_numeric_field\" for user \"alpha_numeric_field\".
DeviceID,alpha_numeric_field
DeviceType,mobile_device
OS,Windows"
| stats list(*) as *
``` data emulation above ```&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Jul 2025 05:43:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750216#M242278</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2025-07-22T05:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: Create new fields using values from another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750237#M242279</link>
      <description>&lt;P&gt;This looks very promising. Thank you for your valued input!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 11:14:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-new-fields-using-values-from-another-field/m-p/750237#M242279</guid>
      <dc:creator>bt149</dc:creator>
      <dc:date>2025-07-22T11:14:49Z</dc:date>
    </item>
  </channel>
</rss>

