<?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: Combining multiple CPU percentage instances to a single instance in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-CPU-percentage-instances-to-a-single-instance/m-p/311451#M161514</link>
    <description>&lt;P&gt;That is neat, I wasn't aware of the multireport function. I had trouble getting the eval case statement working so I ended up using sed on the "instance" field for the values of the apps I was after.&lt;/P&gt;

&lt;P&gt;| search someStuffHere&lt;BR /&gt;
|  rex field=instance mode=sed "s/^chrome(!?.&lt;EM&gt;)/Chrome/g" &lt;BR /&gt;
| rex field=instance mode=sed "s/^iexplore(!?.&lt;/EM&gt;)/InternetExplorer/g" &lt;BR /&gt;
| rex field=instance mode=sed "s/^EXCEL(!?.*)/Excel/g" &lt;/P&gt;

&lt;P&gt;| timechart avg(%_Processor_Time) AS "Avg. % Processor Time" BY instance&lt;/P&gt;

&lt;P&gt;Regex example &lt;A href="https://regex101.com/r/2diOwz/5" target="_blank"&gt;https://regex101.com/r/2diOwz/5&lt;/A&gt;&lt;BR /&gt;
instance=chrome %_Processor_Time=17.8&lt;BR /&gt;
instance=chrome#32 %_Processor_Time=3.5&lt;BR /&gt;
instance=chrome#2 %_Processor_Time=40.0&lt;BR /&gt;
instance=chrome#543 %_Processor_Time=0.0&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 13:37:52 GMT</pubDate>
    <dc:creator>shawngarrettsgp</dc:creator>
    <dc:date>2020-09-29T13:37:52Z</dc:date>
    <item>
      <title>Combining multiple CPU percentage instances to a single instance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-CPU-percentage-instances-to-a-single-instance/m-p/311449#M161512</link>
      <description>&lt;P&gt;So I have CPU data from template for Citrix XenApp addon gathering CPU metrics. Each line on the graph is populated from two fields &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;%_Processor_Time&lt;/STRONG&gt; (0-100 value)&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;instance&lt;/STRONG&gt; (name of the processes chrome#1,chrome#2,iexplore#13, etc.)&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/111418/merge-timechart-column.html" target="_blank"&gt;Referencing this method&lt;/A&gt; its a similar goal but the fields are not as straight forward merging counts of two values. I'm trying to do something similar with the eval I essentially want to do with wildcards be able to lump all the processor stats for a given application into a single field to report on. So in the example below instead of having an average for each instance name I want to do something like the illustrated below.&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/192192-processescombined.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;| eval source=if(source=="chrome*","chromeTotal",source)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:32:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-CPU-percentage-instances-to-a-single-instance/m-p/311449#M161512</guid>
      <dc:creator>shawngarrettsgp</dc:creator>
      <dc:date>2020-09-29T13:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple CPU percentage instances to a single instance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-CPU-percentage-instances-to-a-single-instance/m-p/311450#M161513</link>
      <description>&lt;P&gt;Your solution should work to do JUST the totals so I am assuming that you are asking how to do BOTH.  To do BOTH, do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your original search here
| eval source=case(match(source, "^chrome"),    "chromeTotal",
                   match(source, "^iexplore*"), "ieTotal",
                   true(), source)
| multireport
    [ timechart avg(%_Processor_Time) BY instance ]
    [ timechart avg(%_Processor_Time) BY source]
| stats values(*) AS * BY _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Apr 2017 19:25:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-CPU-percentage-instances-to-a-single-instance/m-p/311450#M161513</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-04-05T19:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple CPU percentage instances to a single instance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-CPU-percentage-instances-to-a-single-instance/m-p/311451#M161514</link>
      <description>&lt;P&gt;That is neat, I wasn't aware of the multireport function. I had trouble getting the eval case statement working so I ended up using sed on the "instance" field for the values of the apps I was after.&lt;/P&gt;

&lt;P&gt;| search someStuffHere&lt;BR /&gt;
|  rex field=instance mode=sed "s/^chrome(!?.&lt;EM&gt;)/Chrome/g" &lt;BR /&gt;
| rex field=instance mode=sed "s/^iexplore(!?.&lt;/EM&gt;)/InternetExplorer/g" &lt;BR /&gt;
| rex field=instance mode=sed "s/^EXCEL(!?.*)/Excel/g" &lt;/P&gt;

&lt;P&gt;| timechart avg(%_Processor_Time) AS "Avg. % Processor Time" BY instance&lt;/P&gt;

&lt;P&gt;Regex example &lt;A href="https://regex101.com/r/2diOwz/5" target="_blank"&gt;https://regex101.com/r/2diOwz/5&lt;/A&gt;&lt;BR /&gt;
instance=chrome %_Processor_Time=17.8&lt;BR /&gt;
instance=chrome#32 %_Processor_Time=3.5&lt;BR /&gt;
instance=chrome#2 %_Processor_Time=40.0&lt;BR /&gt;
instance=chrome#543 %_Processor_Time=0.0&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:37:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-CPU-percentage-instances-to-a-single-instance/m-p/311451#M161514</guid>
      <dc:creator>shawngarrettsgp</dc:creator>
      <dc:date>2020-09-29T13:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple CPU percentage instances to a single instance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-CPU-percentage-instances-to-a-single-instance/m-p/311452#M161515</link>
      <description>&lt;P&gt;Ultimately used sed for the apps I was interested in on the field name "instance"&lt;BR /&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/2721iF90EDD593769EF2A/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search stuffGoesHere
    | rex field=instance mode=sed "s/^chrome(!?.*)/Chrome/g" 
    | rex field=instance mode=sed "s/^iexplore(!?.*)/InternetExplorer/g" 
    | rex field=instance mode=sed "s/^EXCEL(!?.*)/Excel/g" 
    | timechart avg(%_Processor_Time) AS "Avg. % Processor Time" BY instance
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Apr 2017 18:27:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-CPU-percentage-instances-to-a-single-instance/m-p/311452#M161515</guid>
      <dc:creator>shawngarrettsgp</dc:creator>
      <dc:date>2017-04-10T18:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple CPU percentage instances to a single instance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-CPU-percentage-instances-to-a-single-instance/m-p/311453#M161516</link>
      <description>&lt;P&gt;Thanks for posting your solution.  Please "accept" your answer to show the problem is solved, and upvote any other answers you found particularly helpful.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 21:41:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-CPU-percentage-instances-to-a-single-instance/m-p/311453#M161516</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-10T21:41:53Z</dc:date>
    </item>
  </channel>
</rss>

