<?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: Splunk create new field based on table values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-new-field-based-on-table-values/m-p/639618#M221645</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your solution. &amp;nbsp;The solution worked for me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Apr 2023 10:11:47 GMT</pubDate>
    <dc:creator>satish</dc:creator>
    <dc:date>2023-04-12T10:11:47Z</dc:date>
    <item>
      <title>How to create new field based on table values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-new-field-based-on-table-values/m-p/639605#M221637</link>
      <description>&lt;P&gt;Dear Experts..&lt;BR /&gt;Looking for help with a Splunk Query...&lt;BR /&gt;I was working on a Splunk Query to identify the Frames connection to the HMC.. Im able to find the HMC's the frame is connected.. If a frame is connected with 2 hmc the active_hmc field will contain both hmc's separated by "_ "&lt;BR /&gt;Incase the frame is connected with single HMC.. active_hmc contains only one HMC name..&lt;BR /&gt;I would like to create a new field that would contain the actual HMC pair name for each frame..&lt;BR /&gt;For the single HMC active frames, I would like to generate the HMC pair data by searching inside the entire table to see if there is a match..&lt;/P&gt;
&lt;P&gt;For Example:&lt;BR /&gt;==============&lt;BR /&gt;if the field value active_hmc=hmc50.. The same field also will have some frames connected wirh 2 hmcs like active_hmc=hmc49_hmc50.&lt;BR /&gt;&lt;BR /&gt;Would like to find that pairs and create a new field hmc_pair in the table with values hmc_pair=hmc49_hmc50.&lt;/P&gt;
&lt;P&gt;Could you help me with the query.&lt;/P&gt;
&lt;P&gt;Splunk query:&lt;BR /&gt;==================&lt;BR /&gt;index=aix_os source=hmc&lt;BR /&gt;| spath path=hmc_info{} output=LIST&lt;BR /&gt;| mvexpand LIST&lt;BR /&gt;| spath input=LIST&lt;BR /&gt;| where category == "power_frame"&lt;BR /&gt;| dedup hmc_name frame_name&lt;BR /&gt;| stats values(hmc_name) as hmc_names dc(hmc_name) as hmc_count by frame_serial, frame_name, datacenter&lt;BR /&gt;| eval active_hmc=mvjoin(mvsort(hmc_names), "_")&lt;BR /&gt;| eval hmc_pair=mvjoin(mvsort(hmc_names), "_")&lt;BR /&gt;| eval hmc_redundancy=if(hmc_count=2, if(match(active_hmc, "^([^_]+)_([^_]+)$") AND mvcount(mvdedup(hmc_names))=2, "OK", "missing"), "NOT-OK")&lt;BR /&gt;| table active_hmc frame_name, frame_serial,hmc_redundancy, datacenter&lt;BR /&gt;| sort +hmc_redundancy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 16:55:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-new-field-based-on-table-values/m-p/639605#M221637</guid>
      <dc:creator>satish</dc:creator>
      <dc:date>2023-04-12T16:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk create new field based on table values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-new-field-based-on-table-values/m-p/639613#M221642</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252335"&gt;@satish&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I can see on your query that active_hmc and hmc_pair both have the same values. Could you please show us the current output of your query (anonymized) as a sample and your desired output?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 09:43:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-new-field-based-on-table-values/m-p/639613#M221642</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2023-04-12T09:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk create new field based on table values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-new-field-based-on-table-values/m-p/639614#M221643</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=aix_os source=hmc
| spath path=hmc_info{} output=LIST
| mvexpand LIST
| spath input=LIST
| where category == "power_frame"
| dedup hmc_name frame_name
| stats values(hmc_name) as hmc_names dc(hmc_name) as hmc_count by frame_serial frame_name datacenter
| eval hmc_name = hmc_names
| mvexpand hmc_name
| eventstats values(hmc_names) as hmc_pairs by hmc_name
| eval active_hmc=mvjoin(mvsort(hmc_names), "_")
| eval hmc_pair=mvjoin(mvsort(hmc_names), "_")
| eval hmc_redundancy=if(hmc_count=2, if(match(active_hmc, "^([^_]+)_([^_]+)$") AND mvcount(mvdedup(hmc_names))=2, "OK", "missing"), "NOT-OK")
| table active_hmc hmc_pairs frame_name, frame_serial,hmc_redundancy, datacenter
| sort +hmc_redundancy&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Apr 2023 09:45:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-new-field-based-on-table-values/m-p/639614#M221643</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-04-12T09:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk create new field based on table values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-new-field-based-on-table-values/m-p/639618#M221645</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your solution. &amp;nbsp;The solution worked for me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 10:11:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-new-field-based-on-table-values/m-p/639618#M221645</guid>
      <dc:creator>satish</dc:creator>
      <dc:date>2023-04-12T10:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk create new field based on table values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-new-field-based-on-table-values/m-p/639620#M221647</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061"&gt;@scelikok&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Below are the example output details. &amp;nbsp;The solution provided by&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;appears to be working.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Current Output:&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;active_hmc &amp;nbsp; frame_name frame_serial hmc_redundancy datacenter&lt;/DIV&gt;&lt;DIV&gt;hcm5 &amp;nbsp; POWER01 &amp;nbsp; &amp;nbsp;123456 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NOT-OK &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NYC&lt;/DIV&gt;&lt;DIV&gt;hcm5_hmc6 &amp;nbsp;POWER02 &amp;nbsp; &amp;nbsp;876344 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; OK &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NYC&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Expected Output:&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;active_hmc hmc_pair &amp;nbsp; &amp;nbsp;frame_name frame_serial hmc_redundancy datacenter&lt;/DIV&gt;&lt;DIV&gt;hcm5 &amp;nbsp; hcm5_hcm6 &amp;nbsp; &amp;nbsp; POWER01 &amp;nbsp; &amp;nbsp;123456 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NOT-OK &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NYC&lt;/DIV&gt;&lt;DIV&gt;hcm5_hmc6 &amp;nbsp;hcm5_hmc6 &amp;nbsp; &amp;nbsp; POWER02 &amp;nbsp; &amp;nbsp;876344 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; OK &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NYC&lt;/DIV&gt;&lt;P&gt;Thank you both for your quick help and support.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Apr 2023 10:17:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-new-field-based-on-table-values/m-p/639620#M221647</guid>
      <dc:creator>satish</dc:creator>
      <dc:date>2023-04-12T10:17:39Z</dc:date>
    </item>
  </channel>
</rss>

