<?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: Windows CPU by Process - How do I divide field value #1 by field value #2? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Windows-CPU-by-Process-How-do-I-divide-field-value-1-by-field/m-p/303783#M91386</link>
    <description>&lt;P&gt;I just had a poke in some perfmon events and was not able to find the field &lt;CODE&gt;process_cpu_used_percent&lt;/CODE&gt;, where do you get this one from?&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jul 2017 22:06:51 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2017-07-11T22:06:51Z</dc:date>
    <item>
      <title>Windows CPU by Process - How do I divide field value #1 by field value #2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Windows-CPU-by-Process-How-do-I-divide-field-value-1-by-field/m-p/303780#M91383</link>
      <description>&lt;P&gt;I am trying to get a representation of the percentage of CPU used per windows process based on the amount of processors per client server.   To accomplish this I am looking to divide one field value (&lt;STRONG&gt;process_cpu_used_percent)&lt;/STRONG&gt; by another field value (&lt;STRONG&gt;NumberOfLogicalProcessors&lt;/STRONG&gt;) to get the final percentage of cpu used by process (based on the number of processors).  I have written the following search to create the new field (&lt;STRONG&gt;cpu_by_process&lt;/STRONG&gt;), however I do not see it listed in the Fields after I run the search.  Should I be using a stats command instead?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt;&lt;BR /&gt;
Most fields are using the standard perfmon metrics from the Splunk Add-on for Microsoft Windows  (&lt;A href="https://splunkbase.splunk.com/app/742/" target="_blank"&gt;https://splunkbase.splunk.com/app/742/&lt;/A&gt;)  I've created a Powershell script that populates Splunk with the number of Logical Processors per client server to get this baseline, with a field name of &lt;STRONG&gt;NumberOfLogicalProcessors&lt;/STRONG&gt;.   Below is the search I have created, however the eval does not seem to be working properly by dividing the process CPU used by the number of processors per client server.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="perfmon" (sourcetype=Perfmon:Process OR sourcetype=Perfmon:CPU counter="% Processor Time") OR sourcetype=Script:ProcessorCount host=LTJ09OKDU 
| eval cpu_by_process = process_cpu_used_percent / NumberOfLogicalProcessors
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Windows-CPU-by-Process-How-do-I-divide-field-value-1-by-field/m-p/303780#M91383</guid>
      <dc:creator>mightaswelby</dc:creator>
      <dc:date>2020-09-29T14:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Windows CPU by Process - How do I divide field value #1 by field value #2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Windows-CPU-by-Process-How-do-I-divide-field-value-1-by-field/m-p/303781#M91384</link>
      <description>&lt;P&gt;Hi mightaswelby,&lt;/P&gt;

&lt;P&gt;Just three quick things to check:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Not all fields are listed by default, only fields with a coverage of more then 1% are shown - you need to change to &lt;CODE&gt;all fields&lt;/CODE&gt; in the &lt;CODE&gt;select fields&lt;/CODE&gt; view&lt;/LI&gt;
&lt;LI&gt;is &lt;CODE&gt;NumberOfLogicalProcessors&lt;/CODE&gt; a string or a numeric value?&lt;/LI&gt;
&lt;LI&gt;the eval only works if the events have both fields &lt;CODE&gt;NumberOfLogicalProcessors&lt;/CODE&gt; AND &lt;CODE&gt;process_cpu_used_percent&lt;/CODE&gt; available&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 20:56:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Windows-CPU-by-Process-How-do-I-divide-field-value-1-by-field/m-p/303781#M91384</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-07-11T20:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Windows CPU by Process - How do I divide field value #1 by field value #2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Windows-CPU-by-Process-How-do-I-divide-field-value-1-by-field/m-p/303782#M91385</link>
      <description>&lt;P&gt;Thanks for the response MuS.  Yes, I did verify the select all fields.  The NumberOfLogicalProcessors is a numeric field, that is where I am running into the issue.  This value will be dynamic based on the client server Processor Number count. (this works if I divide by a static number in the eval eg: &lt;STRONG&gt;| eval cpu_by_process = process_cpu_used_percent / 4&lt;/STRONG&gt;   And when I run the search (without the eval) I am able to see both fields without issue, NumberOfLogicalProcessors AND process_cpu_used_percent.  I'm just not sure how to approach this one.  &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:50:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Windows-CPU-by-Process-How-do-I-divide-field-value-1-by-field/m-p/303782#M91385</guid>
      <dc:creator>mightaswelby</dc:creator>
      <dc:date>2020-09-29T14:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Windows CPU by Process - How do I divide field value #1 by field value #2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Windows-CPU-by-Process-How-do-I-divide-field-value-1-by-field/m-p/303783#M91386</link>
      <description>&lt;P&gt;I just had a poke in some perfmon events and was not able to find the field &lt;CODE&gt;process_cpu_used_percent&lt;/CODE&gt;, where do you get this one from?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 22:06:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Windows-CPU-by-Process-How-do-I-divide-field-value-1-by-field/m-p/303783#M91386</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-07-11T22:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Windows CPU by Process - How do I divide field value #1 by field value #2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Windows-CPU-by-Process-How-do-I-divide-field-value-1-by-field/m-p/303784#M91387</link>
      <description>&lt;P&gt;I was able to get the results need doing a subsearch.&lt;/P&gt;

&lt;P&gt;index="perfmon" (sourcetype=Perfmon:Process OR sourcetype=Perfmon:CPU counter="% Processor Time")&lt;BR /&gt;
| eval cpu_by_process=process_cpu_used_percent / [search sourcetype="Script:ProcessorCount" host="*"&lt;BR /&gt;
| return $NumberOfLogicalProcessors]&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:50:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Windows-CPU-by-Process-How-do-I-divide-field-value-1-by-field/m-p/303784#M91387</guid>
      <dc:creator>mightaswelby</dc:creator>
      <dc:date>2020-09-29T14:50:58Z</dc:date>
    </item>
  </channel>
</rss>

