<?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 can I sum total memory used by a process? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326055#M97206</link>
    <description>&lt;P&gt;...| bin _time span=30s | timechart minspan=30s sum(Value) &lt;/P&gt;</description>
    <pubDate>Thu, 07 Sep 2017 20:12:36 GMT</pubDate>
    <dc:creator>rphillips_splk</dc:creator>
    <dc:date>2017-09-07T20:12:36Z</dc:date>
    <item>
      <title>How can I sum total memory used by a process?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326049#M97200</link>
      <description>&lt;P&gt;I need to calculate total memory used by a process. There are multiple processes with same root and suffixes. But data sampling is not consistent. Sometimes it comes in as 2 per minute, sometimes 4. Here is a sample:&lt;BR /&gt;
09/07/2017 14:25:56.050 -0400 ,instance=server#1 ,Value=31827849216&lt;BR /&gt;
09/07/2017 14:25:56.050 -0400 ,instance=server ,Value=30434951168&lt;BR /&gt;
09/07/2017 14:25:11.065 -0400 ,instance=server#1 ,Value=31827849216&lt;BR /&gt;
09/07/2017 14:25:11.065 -0400 ,instance=server ,Value=30434951168&lt;BR /&gt;
09/07/2017 14:24:26.064 -0400 ,instance=server#1 ,Value=31827849216&lt;BR /&gt;
09/07/2017 14:24:26.064 -0400 ,instance=server ,Value=30434922496&lt;/P&gt;

&lt;P&gt;How do I sum it for server* by a minute? Can't do average as it would show half the memory used, can't sum as it would show double for times with 4 samples.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 18:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326049#M97200</guid>
      <dc:creator>lbalaur</dc:creator>
      <dc:date>2017-09-07T18:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum total memory used by a process?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326050#M97201</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I need to calculate total memory used by a process&lt;BR /&gt;
How are you determining what process it is if the events don't include a process id or name? &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 07 Sep 2017 19:49:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326050#M97201</guid>
      <dc:creator>rphillips_splk</dc:creator>
      <dc:date>2017-09-07T19:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum total memory used by a process?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326051#M97202</link>
      <description>&lt;P&gt;Using &lt;CODE&gt;stats&lt;/CODE&gt; or &lt;CODE&gt;timechart&lt;/CODE&gt;, you can do &lt;CODE&gt;avg&lt;/CODE&gt; by server and it will average each of them on each server, without worrying about how many are in each bucket. So if you have 20 events with the total memory used for server1 and 3 events for server2, it will give you the proper &lt;CODE&gt;avg&lt;/CODE&gt; for each of the two servers. Sum will do just &lt;STRONG&gt;that&lt;/STRONG&gt;, which is to add them all up. The number disparity could be the problem then. And how would you know how much it was actually using if you don't know how many events there are for each server. Let Splunk do the work.&lt;/P&gt;

&lt;P&gt;So assuming you want to get average mem used across several servers (with the memory used in a field called &lt;CODE&gt;Value&lt;/CODE&gt; and the hostname field called &lt;CODE&gt;instance&lt;/CODE&gt;), you could do something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | timechart span=1m avg(Value) by instance
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you really want the &lt;CODE&gt;sum&lt;/CODE&gt; of the memory used, then I'm not understanding what you would want to do with that data.&lt;/P&gt;

&lt;P&gt;You could also plot &lt;CODE&gt;min&lt;/CODE&gt; and &lt;CODE&gt;max&lt;/CODE&gt; memory used in the same visualization.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 19:50:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326051#M97202</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-09-07T19:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum total memory used by a process?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326052#M97203</link>
      <description>&lt;P&gt;depending on what you want to split by , this might be a helpful start:&lt;/P&gt;

&lt;P&gt;index=x sourcetype=y | bin _time span=30s | timechart minspan=30s sum(Value) by instance&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 19:52:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326052#M97203</guid>
      <dc:creator>rphillips_splk</dc:creator>
      <dc:date>2017-09-07T19:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum total memory used by a process?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326053#M97204</link>
      <description>&lt;P&gt;Is there any way I can group all the server, server#1, server#2 into one? I don't need to see it by specific instance, but a total by all of them.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 19:56:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326053#M97204</guid>
      <dc:creator>lbalaur</dc:creator>
      <dc:date>2017-09-07T19:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum total memory used by a process?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326054#M97205</link>
      <description>&lt;P&gt;host=blahblah sourcetype="Perfmon:Process" process_name="server*" counter="Working Set - Private"&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 19:59:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326054#M97205</guid>
      <dc:creator>lbalaur</dc:creator>
      <dc:date>2017-09-07T19:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum total memory used by a process?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326055#M97206</link>
      <description>&lt;P&gt;...| bin _time span=30s | timechart minspan=30s sum(Value) &lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 20:12:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326055#M97206</guid>
      <dc:creator>rphillips_splk</dc:creator>
      <dc:date>2017-09-07T20:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum total memory used by a process?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326056#M97207</link>
      <description>&lt;P&gt;Could you take the max for each minute, then sum that.  That would give you one data point per minute.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR BASE SEARCH ...
| timechart max(memory) as maxmem span=1m 
| stats sum(maxmem) as totalmem
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Sep 2017 20:13:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326056#M97207</guid>
      <dc:creator>kmorris_splunk</dc:creator>
      <dc:date>2017-09-07T20:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum total memory used by a process?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326057#M97208</link>
      <description>&lt;P&gt;For this kind of thing, the &lt;CODE&gt;per_minute&lt;/CODE&gt; function of &lt;CODE&gt;timechart&lt;/CODE&gt; is perfect.  Because &lt;CODE&gt;timechart&lt;/CODE&gt; always operates on some certain known &lt;CODE&gt;timespan&lt;/CODE&gt;, &lt;CODE&gt;per_minute&lt;/CODE&gt; in your scenario is calculated by taking sum of the &lt;CODE&gt;Value&lt;/CODE&gt; for that timespan and divide it by the timespan's amount of minutes.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 04:13:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326057#M97208</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-09-08T04:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum total memory used by a process?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326058#M97209</link>
      <description>&lt;P&gt;I guess I am confused because I am trying to read this query via ODBC driver. And while it looks ok in splunk, when I bring it into Tableau the only data I see is _time and _span. The actual numbers are not coming through.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 12:29:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326058#M97209</guid>
      <dc:creator>lbalaur</dc:creator>
      <dc:date>2017-09-08T12:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sum total memory used by a process?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326059#M97210</link>
      <description>&lt;P&gt;After some tries I figured the way to collect this for multiple processes and sync the time in the process.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=Hostname source="Perfmon:Memory" counter="Available MBytes"  | eval FreeGB=Value/1024  | bin span=1m _time | dedup _time| fields _time, host, FreeGB | join host [search ComputerName="Hostname " sourcetype=WinHostMon Type=OperatingSystem | eval TotalGB=TotalPhysicalMemoryKB/1048576 |fields  host, TotalGB] | eval  Name="Memory Used", MemUsed=TotalGB-FreeGB | table _time, host, Name, TotalGB, MemUsed | append 
[search host=Hostname AND sourcetype="Perfmon:Process" AND  counter="Working Set - Private"  AND  (process_name="background*" OR 
                                                            process_name="vizqlserver*" OR 
                                                            process_name="dataserver*" OR 
                                                            process_name="tdeserver*" OR
                                                            process_name="redis-server*") |
eval Name=case(like(instance, "background%"),"Backgrounder",  
            like(instance,"vizqlserver%"), "VizQL" ,
            like(instance,"dataserver%"),  "Data server",
            like(instance,"tdeserver%"),"TD engine",
            like(instance,"redis-server%"), "Cache server"),Value = Value/1073741824| bin span=1m _time | dedup _time, instance | stats sum(Value) as MemUsed by _time, Name, host | table _time, host, Name, MemUsed]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After this creating a pretty chart was easy.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 16:48:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-sum-total-memory-used-by-a-process/m-p/326059#M97210</guid>
      <dc:creator>lbalaur</dc:creator>
      <dc:date>2017-09-25T16:48:07Z</dc:date>
    </item>
  </channel>
</rss>

