<?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 value with dynamic key name in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742468#M240857</link>
    <description>&lt;P&gt;Is your data is exactly like this samble, with all those :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\"&lt;/LI-CODE&gt;&lt;P&gt;??&lt;/P&gt;</description>
    <pubDate>Sat, 22 Mar 2025 23:13:35 GMT</pubDate>
    <dc:creator>gargantua</dc:creator>
    <dc:date>2025-03-22T23:13:35Z</dc:date>
    <item>
      <title>How to extract value with dynamic key name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742464#M240854</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;I have the following data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"TIMESTAMP": 1742677200,&lt;BR /&gt;"SYSINFO": "{\"number_of_notconnect_interfaces\":0,\"hostname\":\"test\",\"number_of_transceivers\":{\"10G-LR\":10,\"100G-CWDM4\":20},\"number_of_bfd_peers\":10,\"number_of_bgp_peers\":10,\"number_of_disabled_interfaces\":10,\"number_of_subinterfaces\":{\"Ethernet1\":10,\"Ethernet2\":20},\"number_of_up_interfaces\":1}"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;I would like to create the table as below, but Ethernet1 or Ethernet2 is a dynamic key (it can be like Ethernet3 or Ethernet4).&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Ethernet1&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Ethernet2&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone tell me how to write query to achieve this?&lt;/P&gt;</description>
      <pubDate>Sat, 22 Mar 2025 22:10:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742464#M240854</guid>
      <dc:creator>shimada-k</dc:creator>
      <dc:date>2025-03-22T22:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract value with dynamic key name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742467#M240856</link>
      <description>&lt;P&gt;Just to clarify - This how the data is coming into your index/source and you're trying to manipulate it via SPL?&lt;BR /&gt;&lt;BR /&gt;It looks something like this only an event vs a table?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="catdadof3_0-1742684754431.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38310iFDD373FE82592C63/image-size/medium?v=v2&amp;amp;px=400" role="button" title="catdadof3_0-1742684754431.png" alt="catdadof3_0-1742684754431.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Just checking because I can't tell if this is one long string or an event that has multiple attributes. If it's an event, could you possibly take a screen shot?&lt;BR /&gt;&lt;BR /&gt;It looks like you'd have something where SYSINFO is the top level and each category below is another level. If that's the case, ideally you'd just have SYSINFO.number_of_subinterfaces as a field name you can table.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Mar 2025 23:12:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742467#M240856</guid>
      <dc:creator>catdadof3</dc:creator>
      <dc:date>2025-03-22T23:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract value with dynamic key name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742468#M240857</link>
      <description>&lt;P&gt;Is your data is exactly like this samble, with all those :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\"&lt;/LI-CODE&gt;&lt;P&gt;??&lt;/P&gt;</description>
      <pubDate>Sat, 22 Mar 2025 23:13:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742468#M240857</guid>
      <dc:creator>gargantua</dc:creator>
      <dc:date>2025-03-22T23:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract value with dynamic key name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742469#M240858</link>
      <description>&lt;P&gt;Is this doing what you're trying to do ?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval json="{\"TIMESTAMP\": 1742677200,\"SYSINFO\": \"{\\\"number_of_notconnect_interfaces\\\":0,\\\"hostname\\\":\\\"test\\\",\\\"number_of_transceivers\\\":{\\\"10G-LR\\\":10,\\\"100G-CWDM4\\\":20},\\\"number_of_bfd_peers\\\":10,\\\"number_of_bgp_peers\\\":10,\\\"number_of_disabled_interfaces\\\":10,\\\"number_of_subinterfaces\\\":{\\\"Ethernet1\\\":10,\\\"Ethernet2\\\":20},\\\"number_of_up_interfaces\\\":1}\"}"

|fromjson json
|fromjson SYSINFO
|fields number_of_subinterfaces
|fromjson number_of_subinterfaces
|fields - number_of_subinterfaces _time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Results :&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Ethernet1&lt;/TD&gt;&lt;TD width="50%"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Ethernet2&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Mar 2025 23:24:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742469#M240858</guid>
      <dc:creator>gargantua</dc:creator>
      <dc:date>2025-03-22T23:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract value with dynamic key name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742472#M240861</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults | eval json="{\"TIMESTAMP\": 1742677200,\"SYSINFO\": \"{\\\"number_of_notconnect_interfaces\\\":0,\\\"hostname\\\":\\\"test\\\",\\\"number_of_transceivers\\\":{\\\"10G-LR\\\":10,\\\"100G-CWDM4\\\":20},\\\"number_of_bfd_peers\\\":10,\\\"number_of_bgp_peers\\\":10,\\\"number_of_disabled_interfaces\\\":10,\\\"number_of_subinterfaces\\\":{\\\"Ethernet1\\\":10,\\\"Ethernet2\\\":20},\\\"number_of_up_interfaces\\\":1}\"}"
| spath input=json
| spath input=SYSINFO number_of_subinterfaces
| fields number_of_subinterfaces
| eval keys=json_array_to_mv(json_keys(number_of_subinterfaces),false())
| mvexpand keys
| eval value=json_extract(number_of_subinterfaces,keys)
| fields - _time number_of_subinterfaces&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 23 Mar 2025 09:58:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742472#M240861</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2025-03-23T09:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract value with dynamic key name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742473#M240862</link>
      <description>&lt;P&gt;Thank you very much,&amp;nbsp;&lt;SPAN&gt;ITWhispere. That works.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Mar 2025 13:18:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742473#M240862</guid>
      <dc:creator>shimada-k</dc:creator>
      <dc:date>2025-03-23T13:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract value with dynamic key name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742502#M240866</link>
      <description>&lt;P&gt;Or even that :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval json="{\"TIMESTAMP\": 1742677200,\"SYSINFO\": \"{\\\"number_of_notconnect_interfaces\\\":0,\\\"hostname\\\":\\\"test\\\",\\\"number_of_transceivers\\\":{\\\"10G-LR\\\":10,\\\"100G-CWDM4\\\":20},\\\"number_of_bfd_peers\\\":10,\\\"number_of_bgp_peers\\\":10,\\\"number_of_disabled_interfaces\\\":10,\\\"number_of_subinterfaces\\\":{\\\"Ethernet1\\\":10,\\\"Ethernet2\\\":20},\\\"number_of_up_interfaces\\\":1}\"}"

|fromjson json
|fromjson SYSINFO
|fields number_of_subinterfaces
|fromjson number_of_subinterfaces
|fields - number_of_subinterfaces _time
|transpose header_field=column
|rename "row 1" as value, column as keys&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2025 08:04:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-with-dynamic-key-name/m-p/742502#M240866</guid>
      <dc:creator>gargantua</dc:creator>
      <dc:date>2025-03-24T08:04:28Z</dc:date>
    </item>
  </channel>
</rss>

