<?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 to combine the results ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-the-results/m-p/513426#M144046</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;. My query with your suggestions works now.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Aug 2020 20:11:18 GMT</pubDate>
    <dc:creator>skavuri11</dc:creator>
    <dc:date>2020-08-10T20:11:18Z</dc:date>
    <item>
      <title>How to combine the results ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-the-results/m-p/513395#M144037</link>
      <description>&lt;P&gt;I am new to Splunk. I have the logs in the following format for our servers.&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Host, CPU, %USAGE&lt;/LI&gt;&lt;LI&gt;Host, Memory, %Usage&lt;/LI&gt;&lt;LI&gt;Host, Load Average, % USAGE&lt;/LI&gt;&lt;LI&gt;Host, Swapping, %Usage&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I need to create a query to display the results in the following format.&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;HOST, CPU Avg Usage, Memory Avg Usage, Load Avg Usage, Swapping Avg Usage&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;My query below is printing the same value for each of fields. Ex: it prints the same cpu value for all the rows. Any suggestions on the query?&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;    index = index1 sourcetype=.... source=...
      | eval cpu_usage = [search index = ... sourcetype=... source=*  | search metric_name=CPU_Utilization | stats avg(Usage) as "CPU_Usage" by host_name | return $CPU_Usage ]
      | eval memory_usage = [search index = ... sourcetype=... source=*  | search metric_name=Memory_Utilization | stats avg(Usage) as "Memory_Usage" by host_name | return $Memory_Usage ]
      | eval load_usage = [search index = ... sourcetype=... source=*  | search metric_name=Load_Utilization | stats avg(Usage) as "Load_Usage" by host_name | return $Load_Usage ]
      | eval swapping_usage = [search index = ... sourcetype=... source=*  | search metric_name=Swapping_Utilization | stats avg(Usage) as "Swapping_Usage" by host_name | return $Swapping_Usage ]
      | stats values(cpu_usage) as "CPU Utilization", values(memory_usage) as "Memory  Utilization", values(load_usage) as "Load  Utilization", values(swapping_usage) as "Swapping  Utilization"  by host_name&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 10 Aug 2020 16:21:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-the-results/m-p/513395#M144037</guid>
      <dc:creator>skavuri11</dc:creator>
      <dc:date>2020-08-10T16:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine the results ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-the-results/m-p/513417#M144045</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;please try the next:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;index=_internal 
| head 1
| eval _raw = "Host, metric_name, usage
f1, CPU, 10
f1, mem, 11
f1, mem, 12
f1, swap, 0
f1, load, 10
f1, load, 5
f1, CPU, 1"
| multikv forceheader=1
| makemv metric_name
| rename COMMENTS as "Previous prepare sample data"
| eval {metric_name} = usage
| stats avg(CPU) as aCPU avg(load) as aLoad avg(mem) as aMem avg(swap) as aSwap by Host&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here I suppose that you have field names: Host, metric_name, usage in your events.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Last two rows do the logic:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;create new field name value of metric_name (CPU, men, swap or load) and assign usage% to it&lt;/LI&gt;&lt;LI&gt;stats just count averages by Host&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 18:43:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-the-results/m-p/513417#M144045</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-08-10T18:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine the results ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-the-results/m-p/513426#M144046</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;. My query with your suggestions works now.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 20:11:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-the-results/m-p/513426#M144046</guid>
      <dc:creator>skavuri11</dc:creator>
      <dc:date>2020-08-10T20:11:18Z</dc:date>
    </item>
  </channel>
</rss>

