<?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: UNIX CPU data extraction for multiple hosts in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447243#M191215</link>
    <description>&lt;P&gt;Hi sukisen, &lt;BR /&gt;
Timechart command is not taking a second argument, so it errors out. Any other ideas pls&lt;/P&gt;</description>
    <pubDate>Thu, 15 Aug 2019 02:26:11 GMT</pubDate>
    <dc:creator>johnsasikumar</dc:creator>
    <dc:date>2019-08-15T02:26:11Z</dc:date>
    <item>
      <title>UNIX CPU data extraction for multiple hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447240#M191212</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
Am trying to extract UNIX CPU data core wise for multiple hosts, Am using the below query for extract, &lt;/P&gt;

&lt;P&gt;source=cpu host="XYZ"&lt;BR /&gt;
| multikv fields CPU pctIdle&lt;BR /&gt;
| eval Percent_CPU_Load = 100 - pctIdle &lt;BR /&gt;
| timechart span=5m eval(round(avg(Percent_CPU_Load),0)) by CPU&lt;BR /&gt;
| table _time all *&lt;BR /&gt;
| eval _time=strftime(_time,"%m/%d/%Y %H:%M:%S")&lt;BR /&gt;
| table _time all *&lt;/P&gt;

&lt;P&gt;however this looses the host field after the timechart command and am not able to view name of the host in the table.&lt;/P&gt;

&lt;P&gt;"_time",all,0,1,2,3,4,5,6,7&lt;BR /&gt;
"08/14/2019 14:35:00",3,3,4,4,5,3,2,3,2&lt;BR /&gt;
"08/14/2019 14:40:00",5,5,7,6,5,5,4,5,4&lt;BR /&gt;
"08/14/2019 14:45:00",4,4,4,5,5,4,4,3,4&lt;BR /&gt;
"08/14/2019 14:50:00",2,2,1,2,2,2,5,4,1&lt;/P&gt;

&lt;P&gt;I also tried with the bucket and stats command which gives the host field (query as below) but, it changes the format.&lt;/P&gt;

&lt;P&gt;index=main host="XYZ" source=cpu&lt;BR /&gt;
| multikv fields pctIdle  host CPU&lt;BR /&gt;
| eval Percent_CPU_Load = 100 - pctIdle&lt;BR /&gt;
| table _time host CPU Percent_CPU_Load&lt;BR /&gt;
| bucket _time span=5m&lt;BR /&gt;
| stats avg(Percent_CPU_Load) by _time,CPU,host&lt;/P&gt;

&lt;P&gt;"_time",CPU,host,"avg(Percent_CPU_Load)"&lt;BR /&gt;
"2019-08-13T14:00:00.000-0400",0,"XYZ","1.9040000000000006"&lt;BR /&gt;
"2019-08-13T14:00:00.000-0400",1,"XYZ","2.8860000000000015"&lt;BR /&gt;
"2019-08-13T14:00:00.000-0400",2,"XYZ","2.1960000000000006"&lt;BR /&gt;
"2019-08-13T14:00:00.000-0400",3,"XYZ","2.7099999999999995"&lt;BR /&gt;
"2019-08-13T14:00:00.000-0400",4,"XYZ","2.5839999999999987"&lt;BR /&gt;
"2019-08-13T14:00:00.000-0400",5,"XYZ","2.595"&lt;BR /&gt;
"2019-08-13T14:00:00.000-0400",6,"XYZ","2.1990000000000007"&lt;BR /&gt;
"2019-08-13T14:00:00.000-0400",7,"XYZ","2.093000000000001"&lt;/P&gt;

&lt;P&gt;Am also unable to use an eval command and add a host field, Because the query is for an extract and I might need to add multiple hosts.&lt;BR /&gt;
So please could some one help me with an extract in the below format&lt;/P&gt;

&lt;P&gt;_time, Host, all,0,1,2,3,4,5,6,7&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:44:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447240#M191212</guid>
      <dc:creator>johnsasikumar</dc:creator>
      <dc:date>2020-09-30T01:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX CPU data extraction for multiple hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447241#M191213</link>
      <description>&lt;P&gt;what happens if inyour first code, you just tinker with the timechart a bit&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart span=5m eval(round(avg(Percent_CPU_Load),0)) ,values(host) by CPU
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2019 19:25:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447241#M191213</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-14T19:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX CPU data extraction for multiple hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447242#M191214</link>
      <description>&lt;P&gt;Hi Sukisen,&lt;BR /&gt;
Timechart command doesn’t accept a second argument. So it’s throwing an error.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 02:24:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447242#M191214</guid>
      <dc:creator>johnsasikumar</dc:creator>
      <dc:date>2019-08-15T02:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX CPU data extraction for multiple hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447243#M191215</link>
      <description>&lt;P&gt;Hi sukisen, &lt;BR /&gt;
Timechart command is not taking a second argument, so it errors out. Any other ideas pls&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 02:26:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447243#M191215</guid>
      <dc:creator>johnsasikumar</dc:creator>
      <dc:date>2019-08-15T02:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX CPU data extraction for multiple hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447244#M191216</link>
      <description>&lt;P&gt;hi @johnsasikumar  the issue is with the renaming try this. Timechart won;t take more than 1 field AFTER the by clause , but there are no restrictions before the by clause&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart span=5m eval(round(avg(Percent_CPU_Load),0)) as cpu_load ,values(host) as host by CPU
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Aug 2019 06:04:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447244#M191216</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-15T06:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX CPU data extraction for multiple hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447245#M191217</link>
      <description>&lt;P&gt;Hi @Sukisen1981 &lt;BR /&gt;
I did try and rename, it works when I give one host. But it doesn’t work for multiple hosts. &lt;BR /&gt;
When I add an additional host it doesn’t work&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 08:39:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447245#M191217</guid>
      <dc:creator>johnsasikumar</dc:creator>
      <dc:date>2019-08-15T08:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX CPU data extraction for multiple hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447246#M191218</link>
      <description>&lt;P&gt;in your first code  having the timechart, what if you also extract the host using multikv?&lt;BR /&gt;
    source=cpu host="XYZ"&lt;BR /&gt;
    | multikv fields CPU pctIdle host&lt;/P&gt;

&lt;P&gt;and then apply the timechart with rename?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 10:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/UNIX-CPU-data-extraction-for-multiple-hosts/m-p/447246#M191218</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-15T10:07:37Z</dc:date>
    </item>
  </channel>
</rss>

