<?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 create an iterative search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-iterative-search/m-p/39626#M9054</link>
    <description>&lt;P&gt;How do I sort the output of the stats by the count statement?&lt;/P&gt;</description>
    <pubDate>Mon, 20 Aug 2012 18:28:13 GMT</pubDate>
    <dc:creator>timbCFCA</dc:creator>
    <dc:date>2012-08-20T18:28:13Z</dc:date>
    <item>
      <title>How to create an iterative search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-iterative-search/m-p/39623#M9051</link>
      <description>&lt;P&gt;I'm trying to correlate my printer entries along the top printer / user combination line. &lt;BR /&gt;
What I'm looking for in the way of output would be something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;printer name 1 | user name 1 | user name 1 count | user name 2 | user name 2 count | ... etc. 
printer name 2 | user name 3 | user name 3 count | user name 2 | user name 2 count | ... etc.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have a search prepared to locate the printer names in the first column:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;evtid=10 host=print1* OR host=print2* NOT evtuser=*$ | table Printer_Name | dedup Printer_Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also have a search that provides the data I want for the remaining columns:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;evtid=10 host=print1* OR host=print2* NOT evtuser=*$ Printer_Name=PR-EAST | chart count by Printer_Name, evtuser
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I glue these together to get the results I need? I'd rather not have to run hundreds of these queries by hand. I looked at subsearches and it doesn't look like that does quite what I need. &lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 18:15:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-iterative-search/m-p/39623#M9051</guid>
      <dc:creator>timbCFCA</dc:creator>
      <dc:date>2012-08-20T18:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an iterative search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-iterative-search/m-p/39624#M9052</link>
      <description>&lt;P&gt;Do it all in one search try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;evtid=10 host=print1* OR host=print2* NOT evtuser=*$ Printer_Name=*| stats count by Printer_Name, evtuser | sort 0 Printer_Name, evtuser | stats list(evtuser) as users list(count) as counts by Printer_Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give you each printer and then the users and counts in mv fileds. You can use further eval commands to pivot them into columns if you like. If you want one mv field just eval them together before final stats:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;evtid=10 host=print1* OR host=print2* NOT evtuser=*$ Printer_Name=*| stats count by Printer_Name, evtuser | sort 0 Printer_Name, evtuser | eval data=evtuser+":"+count | stats list(data) as data by Printer_Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 18:23:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-iterative-search/m-p/39624#M9052</guid>
      <dc:creator>tfletcher_splun</dc:creator>
      <dc:date>2012-08-20T18:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an iterative search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-iterative-search/m-p/39625#M9053</link>
      <description>&lt;P&gt;Perfect. I just wasn't sure what the necessary syntax was.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 18:25:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-iterative-search/m-p/39625#M9053</guid>
      <dc:creator>timbCFCA</dc:creator>
      <dc:date>2012-08-20T18:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an iterative search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-iterative-search/m-p/39626#M9054</link>
      <description>&lt;P&gt;How do I sort the output of the stats by the count statement?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 18:28:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-iterative-search/m-p/39626#M9054</guid>
      <dc:creator>timbCFCA</dc:creator>
      <dc:date>2012-08-20T18:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an iterative search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-iterative-search/m-p/39627#M9055</link>
      <description>&lt;P&gt;change the order in the sort pipeline to include count. (I assume you still want it by printer)&lt;BR /&gt;
    ... | sort 0 Printer_Name, count, evtuser | ...&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 19:40:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-iterative-search/m-p/39627#M9055</guid>
      <dc:creator>tfletcher_splun</dc:creator>
      <dc:date>2012-08-20T19:40:49Z</dc:date>
    </item>
  </channel>
</rss>

