<?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 write search query with two commands in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-search-query-with-two-commands/m-p/29941#M6053</link>
    <description>&lt;P&gt;Sounds like you could use the addtotals search command so try the following search query: your_search | addtotals&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jun 2011 08:46:12 GMT</pubDate>
    <dc:creator>Ant1D</dc:creator>
    <dc:date>2011-06-17T08:46:12Z</dc:date>
    <item>
      <title>How to write search query with two commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-search-query-with-two-commands/m-p/29940#M6052</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have 3 guest and each guest has 10 hosts in it. i want to display data in pie chart.&lt;/P&gt;

&lt;P&gt;my query conditions are :&lt;/P&gt;

&lt;P&gt;Want to display sum of latest value over hosts by guest.&lt;BR /&gt;
First i need to find out latest values of host and then sum up that values guest.&lt;/P&gt;

&lt;P&gt;My current query is:-&lt;/P&gt;

&lt;P&gt;index="test" sourcetype="power_usage" | eval guest=ltrim(source,"/opt/app/powersupply/") | eval guest=split(guest,"/") |  eval guest=mvindex(guest,-3) | chart first(Power_consumption) as a over host by guest &lt;/P&gt;

&lt;P&gt;This query is giving latest values of hosts by guest. Next i need to sum up latest values. What would be the approach to do this. &lt;/P&gt;

&lt;P&gt;Please help, if anybody knows the solution.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;

&lt;P&gt;Geetanjali&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:41:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-search-query-with-two-commands/m-p/29940#M6052</guid>
      <dc:creator>geetanjali</dc:creator>
      <dc:date>2020-09-28T09:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to write search query with two commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-search-query-with-two-commands/m-p/29941#M6053</link>
      <description>&lt;P&gt;Sounds like you could use the addtotals search command so try the following search query: your_search | addtotals&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2011 08:46:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-search-query-with-two-commands/m-p/29941#M6053</guid>
      <dc:creator>Ant1D</dc:creator>
      <dc:date>2011-06-17T08:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to write search query with two commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-search-query-with-two-commands/m-p/29942#M6054</link>
      <description>&lt;P&gt;Keep your original search for the first need and use this one for the other need:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="test" sourcetype="power_usage" | eval guest=ltrim(source,"/opt/app/powersupply/") | eval guest=split(guest,"/") | eval guest=mvindex(guest,-3) | stats first(Power_consumption) as a BY host,guest | stats sum(a) BY host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 May 2015 23:02:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-search-query-with-two-commands/m-p/29942#M6054</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-28T23:02:28Z</dc:date>
    </item>
  </channel>
</rss>

