<?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 use values in field names to calculate against field values from eval or rex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250200#M74712</link>
    <description>&lt;P&gt;Does "resources_available.jg_n16_128_none_FDR1_rd_a" comes as full field name? Do all these lines are part on one event ?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 10:09:39 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2020-09-29T10:09:39Z</dc:date>
    <item>
      <title>How to use values in field names to calculate against field values from eval or rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250199#M74711</link>
      <description>&lt;P&gt;Sample data:&lt;BR /&gt;
I have several field values in one sourcetype that are variable limits that can change week by week.  The need I have is to always take the value of the field which can change, and divide it by the n# value in the field name. So for example, in the first line, I need to take 512 and divide that by 16 and have the solution be the new value of that field, and I need to do this for each field. So far, I've come up empty on how to appropriately do this.  Any ideas?&lt;/P&gt;

&lt;P&gt;resources_available.jg_n16_128_none_FDR1_rd_a = 512&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_gsu_a = 1584&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_gsu_b = 3200&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_gsu_c = 1600&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_gsu_d = 0&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_gsu_e = 0&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_gsu_f = 0&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_rd_a = 0&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_rd_b = 0&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_rd_c = 0&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_rd_d = 0&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_rd_e = 0&lt;BR /&gt;
    resources_available.jg_n16_128_none_FEX_rd_f = 0&lt;BR /&gt;
    resources_available.jg_n24_256_kepler_FEX_gsu_a = 4920&lt;BR /&gt;
    resources_available.jg_n24_256_kepler_FEX_gsu_b = 0&lt;BR /&gt;
    resources_available.jg_n24_256_kepler_FEX_gsu_c = 0&lt;BR /&gt;
    resources_available.jg_n24_256_kepler_FEX_rd_a = 720&lt;BR /&gt;
    resources_available.jg_n24_256_kepler_FEX_rd_b = 0&lt;BR /&gt;
    resources_available.jg_n24_256_kepler_FEX_rd_c = 0&lt;BR /&gt;
    resources_available.jg_n24_256_none_FDR2_rd_a = 4320&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_Q1_a = 2400&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_gsu_a = 12000&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_gsu_b = 0&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_gsu_c = 0&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_gsu_d = 0&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_gsu_e = 0&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_gsu_f = 0&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_rd_a = 2400&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_rd_b = 14928&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_rd_c = 0&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_rd_d = 0&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_rd_e = 0&lt;BR /&gt;
    resources_available.jg_n24_256_none_FEX_rd_f = 0&lt;BR /&gt;
    resources_available.jg_n24_256_pdd_FEX_sco_a = 48&lt;BR /&gt;
    resources_available.jg_n24_256_testa_FEX_gsu_a = 24&lt;BR /&gt;
    resources_available.jg_n24_256_testb_FEX_gsu_a = 24&lt;BR /&gt;
    resources_available.jg_n24_512_k80_FDR3_rd_a = 936&lt;BR /&gt;
    resources_available.jg_n24_512_k80_FDR3_rd_b = 0&lt;BR /&gt;
    resources_available.jg_ntape16_128_none_FEX_sco_a = 96&lt;BR /&gt;
    resources_available.jg_t24_256_none_FDR2_rd_a = 96&lt;BR /&gt;
    resources_available.jg_t24_256_none_FEX_rd_a = 480&lt;BR /&gt;
    resources_available.jg_test = 240&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:10:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250199#M74711</guid>
      <dc:creator>mjones414</dc:creator>
      <dc:date>2020-09-29T10:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use values in field names to calculate against field values from eval or rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250200#M74712</link>
      <description>&lt;P&gt;Does "resources_available.jg_n16_128_none_FDR1_rd_a" comes as full field name? Do all these lines are part on one event ?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:09:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250200#M74712</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T10:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to use values in field names to calculate against field values from eval or rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250201#M74713</link>
      <description>&lt;P&gt;Is this what you are looking for?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search
| foreach resources_available.* [eval temp="&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;" | rex field=temp "\_n(?&amp;lt;n&amp;gt;\d+)\_" | eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'/n ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | fields - count
| eval resources_available.jg_n16_128_none_FDR1_rd_a = 512
| eval resources_available.jg_n16_128_none_FEX_rd_f = 0
| eval resources_available.jg_n24_256_kepler_FEX_rd_a = 720
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output: see picture below&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1562iC5A50866C0A1FA6E/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 15:21:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250201#M74713</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-07-08T15:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use values in field names to calculate against field values from eval or rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250202#M74714</link>
      <description>&lt;P&gt;See if this gives you what you are looking for&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | table resouce_available* | transpose | rename column AS field row1 as value | rex field=field "\_n(?&amp;lt;n&amp;gt;\d+)\_" | eval value=value/n
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Jul 2016 15:30:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250202#M74714</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-08T15:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use values in field names to calculate against field values from eval or rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250203#M74715</link>
      <description>&lt;P&gt;If we ever meet, I will buy you a beer!  This is EXACTLY what I was looking for!!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 15:45:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250203#M74715</guid>
      <dc:creator>mjones414</dc:creator>
      <dc:date>2016-07-08T15:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use values in field names to calculate against field values from eval or rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250204#M74716</link>
      <description>&lt;P&gt;All these lines are part of one avent and yes that would be the full field name with splunk graciously changing .'s to _s's because it hates .'s in field names &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 15:48:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-values-in-field-names-to-calculate-against-field/m-p/250204#M74716</guid>
      <dc:creator>mjones414</dc:creator>
      <dc:date>2016-07-08T15:48:10Z</dc:date>
    </item>
  </channel>
</rss>

