<?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 do I use a stats sum and then divide by a field not used when summing? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-stats-sum-and-then-divide-by-a-field-not-used/m-p/333948#M175292</link>
    <description>&lt;P&gt;I have events that have&lt;/P&gt;

&lt;P&gt;tablespace, tablespace_size, table_owner, table_name, table_size &lt;/P&gt;

&lt;P&gt;ie&lt;BR /&gt;
 WORK_TS 10000000 joe  Joe_table1  1000&lt;BR /&gt;
 WORK_TS 10000000 joe  Joe_table2  5000 &lt;BR /&gt;
 WORK_TS 10000000 mary Mary_table1 3000&lt;BR /&gt;
 WORK_TS 10000000 mary Mary_table2 7000&lt;BR /&gt;
 PROD_TS 10000000 joe  Joe_table3  1000&lt;BR /&gt;
 PROD_TS 10000000 joe  Joe_table4  5000 &lt;BR /&gt;
 PROD_TS 10000000 mary Mary_table3 3000&lt;BR /&gt;
 PROD_TS 10000000 mary Mary_table4 7000 &lt;/P&gt;

&lt;P&gt;I want to sum the total space used in a tablespace by the table_owner, tablespace and then divide that sum by the tablespace_size&lt;/P&gt;

&lt;P&gt;index="oracle" source="oracle_tables" | stats sum(table_size) as owner_used_space by table_owner, tablespace&lt;/P&gt;

&lt;P&gt;I get the sums but cannot divide by them by the tablespace_size&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 13:05:39 GMT</pubDate>
    <dc:creator>riotto</dc:creator>
    <dc:date>2020-09-29T13:05:39Z</dc:date>
    <item>
      <title>How do I use a stats sum and then divide by a field not used when summing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-stats-sum-and-then-divide-by-a-field-not-used/m-p/333948#M175292</link>
      <description>&lt;P&gt;I have events that have&lt;/P&gt;

&lt;P&gt;tablespace, tablespace_size, table_owner, table_name, table_size &lt;/P&gt;

&lt;P&gt;ie&lt;BR /&gt;
 WORK_TS 10000000 joe  Joe_table1  1000&lt;BR /&gt;
 WORK_TS 10000000 joe  Joe_table2  5000 &lt;BR /&gt;
 WORK_TS 10000000 mary Mary_table1 3000&lt;BR /&gt;
 WORK_TS 10000000 mary Mary_table2 7000&lt;BR /&gt;
 PROD_TS 10000000 joe  Joe_table3  1000&lt;BR /&gt;
 PROD_TS 10000000 joe  Joe_table4  5000 &lt;BR /&gt;
 PROD_TS 10000000 mary Mary_table3 3000&lt;BR /&gt;
 PROD_TS 10000000 mary Mary_table4 7000 &lt;/P&gt;

&lt;P&gt;I want to sum the total space used in a tablespace by the table_owner, tablespace and then divide that sum by the tablespace_size&lt;/P&gt;

&lt;P&gt;index="oracle" source="oracle_tables" | stats sum(table_size) as owner_used_space by table_owner, tablespace&lt;/P&gt;

&lt;P&gt;I get the sums but cannot divide by them by the tablespace_size&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:05:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-stats-sum-and-then-divide-by-a-field-not-used/m-p/333948#M175292</guid>
      <dc:creator>riotto</dc:creator>
      <dc:date>2020-09-29T13:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a stats sum and then divide by a field not used when summing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-stats-sum-and-then-divide-by-a-field-not-used/m-p/333949#M175293</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="oracle" source="oracle_tables" | stats sum(table_size) as owner_used_space max(tablespace_size) as tablespace_size  by table_owner, tablespace | eval percent_owner_used_space=round(owner_used_space*100/tablespace_size,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Mar 2017 22:25:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-stats-sum-and-then-divide-by-a-field-not-used/m-p/333949#M175293</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-02T22:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a stats sum and then divide by a field not used when summing?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-stats-sum-and-then-divide-by-a-field-not-used/m-p/333950#M175294</link>
      <description>&lt;P&gt;seems so simple now....Works like a champ!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 23:34:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-a-stats-sum-and-then-divide-by-a-field-not-used/m-p/333950#M175294</guid>
      <dc:creator>riotto</dc:creator>
      <dc:date>2017-03-02T23:34:48Z</dc:date>
    </item>
  </channel>
</rss>

