<?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: Stats table manipulation in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340478#M100989</link>
    <description>&lt;P&gt;@scottprigge - YW.  It seemed like you were most interested in learning, rather than solving the particular issue, so I figured the demos were more in keeping with the need.  &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Add line 15.5 to "break it up" demo&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| sort 0  Date User Device Time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;&lt;CODE&gt;Where&lt;/CODE&gt; evaluates both sides of the  equation, &lt;CODE&gt;search&lt;/CODE&gt; assumes the right side is a literal&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Oh, here, these two are equivalent...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval Device=(if(isnull(Device),Address,Device))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval Device=coalesce(Device,Address)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 19 Sep 2017 21:36:12 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-09-19T21:36:12Z</dc:date>
    <item>
      <title>Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340470#M100981</link>
      <description>&lt;P&gt;I created the following search to audit the changes made to our network infrastructure:&lt;BR /&gt;
&lt;CODE&gt;(index=ise Protocol=Tacacs MESSAGE_CODE=5202) OR (index=acs process="Tacacs-Accounting" MESSAGE_CODE=3300)&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| rex field=CmdSet mode=sed "s/^\[(?: )?|CmdAV= ?\]?|CmdArgAV=(?:)?|(?:)?\s\]//g"&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| where CmdSet!=""&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| lookup dnslookup clientip AS Address OUTPUT clienthost AS Device&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| eval Device=(if(isnull(Device),Address,Device)), Time=strftime(_time,"%H:%M:%S")&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| eval Date=strftime(_time, "%m")."-".date_mday."-".date_year&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| stats list(CmdSet) AS Command, list(Time) AS Time BY Date,User,Device&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Here's some sample output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Date          User     Device           Command                                               Time
09-14-2017  admin   access-switch    switchport access vlan 600                            13:13:32
                                        interface GigabitEthernet 1/0/26                      13:13:25
                                        no shutdown                                           13:13:57
                                        shutdown                                              13:13:56
09-14-2017  admin   core-router      transfer upload start                                 17:36:08
                                        transfer upload password &amp;lt;hidden&amp;gt;                     17:36:08
                                        transfer upload username transfer                     17:36:08
                                        transfer upload filename core-router-confg            17:36:07
                                        transfer upload serverip 10.10.10.1                   17:36:07
                                        transfer upload datatype config                       17:36:07
                                        transfer upload port 21                               17:36:06
                                        transfer upload mode ftp                              17:36:06
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There's a couple of issues I'm really struggling with:&lt;BR /&gt;
1. I would like to eliminate rows /AFTER/ the stats command where the Command starts with 'transfer upload' or any number of other command snippets. I have spent the day trying various techniques like &lt;CODE&gt;|where&lt;/CODE&gt; but I can't seem to figure how eliminate these rows. I realize I can do this with a regex before the stats, but I'm trying to learn some more advanced techniques.&lt;BR /&gt;
2. I can't figure out how to sort the rows by Time. When I use the &lt;CODE&gt;sort&lt;/CODE&gt; command, I lose all of the grouping and it becomes table output. Is there a way to sort the Commands in the stats output based on the Time column (also preserving the value in the Time column)?&lt;BR /&gt;
3. There are some rows where the list() limit of 100 is a factor. Is there a better way to construct this search to work around that limit (as opposed to increasing the limit)? I tried using values(), but I seem to loose the relationship between the Command and Time fields.&lt;/P&gt;

&lt;P&gt;Really struggling here, thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 20:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340470#M100981</guid>
      <dc:creator>_smp_</dc:creator>
      <dc:date>2017-09-15T20:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340471#M100982</link>
      <description>&lt;P&gt;--&amp;gt; To eliminate transfer upload  from stats result&lt;/P&gt;

&lt;P&gt;Instead of where replace it with search CmdSet!="" AND Cmdset!=transfer*&lt;/P&gt;

&lt;P&gt;For the list You need to bump the size in limits.conf&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 20:20:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340471#M100982</guid>
      <dc:creator>naidusadanala</dc:creator>
      <dc:date>2017-09-15T20:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340472#M100983</link>
      <description>&lt;P&gt;for your first request, after reading it a few times, are you looking to remove any Command that contains "transfer upload"? if so, you could try &lt;CODE&gt;(index=ise Protocol=Tacacs MESSAGE_CODE=5202) OR (index=acs process="Tacacs-Accounting" MESSAGE_CODE=3300) | rex field=CmdSet mode=sed "s/^\[(?: )?|CmdAV= ?\]?|CmdArgAV=(?:)?|(?:)?\s\]//g" | where CmdSet!="" |search CmdSet!="transfer upload*"|...&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 20:24:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340472#M100983</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-09-15T20:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340473#M100984</link>
      <description>&lt;P&gt;Thanks, but is there a way to do this /after/ the stats command? I'm trying to get more sophisticated with the language.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 20:27:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340473#M100984</guid>
      <dc:creator>_smp_</dc:creator>
      <dc:date>2017-09-15T20:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340474#M100985</link>
      <description>&lt;P&gt;I updated my description of #1. I didn't even think to use this technique (duh!) so thanks for the post. I am wondering if there's a way to remove certain rows after the stats() command.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 20:31:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340474#M100985</guid>
      <dc:creator>_smp_</dc:creator>
      <dc:date>2017-09-15T20:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340475#M100986</link>
      <description>&lt;P&gt;Place |search Cmdset!=transfer*  at the end of the search&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 20:34:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340475#M100986</guid>
      <dc:creator>naidusadanala</dc:creator>
      <dc:date>2017-09-15T20:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340476#M100987</link>
      <description>&lt;P&gt;Here's some stuff to play with...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=ise Protocol=Tacacs MESSAGE_CODE=5202) OR (index=acs process="Tacacs-Accounting" MESSAGE_CODE=3300)
| rex field=CmdSet mode=sed "s/^\[(?: )?|CmdAV= ?\]?|CmdArgAV=(?:)?|(?:)?\s\]//g"
| where CmdSet!=""
| lookup dnslookup clientip AS Address OUTPUT clienthost AS Device
| eval Device=(if(isnull(Device),Address,Device)), Time=strftime(_time,"%H:%M:%S")
| eval Date=strftime(_time,"%Y-%m-%d")
| eval Command=Time." ".CmdSet
| stats values(Command) AS Command BY Date,User,Device
| eval Command=mvfilter(NOT match(Command,"transfer"))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;NOTE - You will save yourself loads of headaches if you just get yourself and your users accustomed to seeing dates in an order where they sort correctly, like "2017-09-11".  That way you can compare directly and also read directly without conversion.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;And some more stuff to play with...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=ise Protocol=Tacacs MESSAGE_CODE=5202) OR (index=acs process="Tacacs-Accounting" MESSAGE_CODE=3300)
| rex field=CmdSet mode=sed "s/^\[(?: )?|CmdAV= ?\]?|CmdArgAV=(?:)?|(?:)?\s\]//g"
| where CmdSet!=""
| lookup dnslookup clientip AS Address OUTPUT clienthost AS Device
| eval Device=(if(isnull(Device),Address,Device)), Time=strftime(_time,"%H:%M:%S")
| eval Date=strftime(_time,"%Y-%m-%d")
| stats list(CmdSet) AS Command, list(Time) AS Time BY Date,User,Device


| rename COMMENT as "Pretending for the moment that you had a report as above, but needed to break it up."
| eval TimeCommand=mvzip(Time,Command,"-&amp;gt;")
| fields - Command Time
| mvexpand TimeCommand
| rex field=TimeCommand "(?&amp;lt;Time&amp;gt;[^-]+)-&amp;gt;(?&amp;lt;Command&amp;gt;.*)"
| search NOT match(Command,"transfer") 
| stats list(Command) AS Command, list(Time) AS Time BY Date,User,Device
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;| rename COMMENT as "Or another way, if you are okay leaving them together afterwards."
| eval TimeCommand=mvzip(Time,Command,"-&amp;gt;")
| fields - Command Time
| mvexpand TimeCommand
| rex field=TimeCommand "(?&amp;lt;Time&amp;gt;[^-]+)-&amp;gt;(?&amp;lt;Command&amp;gt;.*)"
| search NOT match(Command,"transfer") 
| rex mode=sed field=TimeCommand "s/-&amp;gt;/  /g"
| mvcombine TimeCommand
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;updated to close quotes on two rexes.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 21:38:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340476#M100987</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-15T21:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340477#M100988</link>
      <description>&lt;P&gt;Very useful reply, thanks. You obviously pointed out a lot of techniques I never even thought about. You also caused me to study the &lt;CODE&gt;where&lt;/CODE&gt; command enough to realize I wasn't using it correctly. After I figured that out, I was able to use it to eliminate the commands. Unfortunately it didn't appear that your 'break it up' example correctly sorted by the Time column. But using your technique of prepending the 'Time' string to the 'Command' field had the effect I was looking for. I would still like to understand how to sort by Time in a separate column but this is good enough. Here's the search I landed on:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;(index=ise Protocol=Tacacs MESSAGE_CODE=5202) OR (index=acs process="Tacacs-Accounting" MESSAGE_CODE=3300)&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| rex field=CmdSet mode=sed "s/^\[(?: )?|CmdAV= ?\]?|CmdArgAV=(?:&amp;lt;cr&amp;gt;)?|(?:&amp;lt;cr&amp;gt;)?\s\]//g"&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| where CmdSet!=""&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| lookup dnslookup clientip AS Address OUTPUT clienthost AS Device&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| eval Device=(if(isnull(Device),Address,Device)), Time=strftime(_time,"%H:%M:%S"), Date=strftime(_time,"%Y-%m-%d")&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| where NOT (match(User, "admin1") AND (match(CmdSet, "configure terminal") OR match(CmdSet, "transfer upload")))&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| where NOT (match(User, "admin2") AND (match(CmdSet, "switchto (\\\;|vdc)") OR match(CmdSet, "copy.*tftp")))&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| eval Command="(".Time.")&amp;gt; ".CmdSet&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;| stats values(Command) AS Command BY Date,User,Device&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Thanks for taking the time to teach me something - this was a really useful exercise!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2017 19:30:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340477#M100988</guid>
      <dc:creator>_smp_</dc:creator>
      <dc:date>2017-09-19T19:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340478#M100989</link>
      <description>&lt;P&gt;@scottprigge - YW.  It seemed like you were most interested in learning, rather than solving the particular issue, so I figured the demos were more in keeping with the need.  &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Add line 15.5 to "break it up" demo&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| sort 0  Date User Device Time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;&lt;CODE&gt;Where&lt;/CODE&gt; evaluates both sides of the  equation, &lt;CODE&gt;search&lt;/CODE&gt; assumes the right side is a literal&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Oh, here, these two are equivalent...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval Device=(if(isnull(Device),Address,Device))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval Device=coalesce(Device,Address)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Sep 2017 21:36:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340478#M100989</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-19T21:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340479#M100990</link>
      <description>&lt;P&gt;You are right - this is also a bit of a learning exercise, trying to become more advanced with my searches. Thanks for taking a helpful approach.&lt;/P&gt;

&lt;P&gt;Are you sure the &lt;CODE&gt;search NOT match(Command,"transfer")&lt;/CODE&gt; syntax works like that? When I try it against a Command or even a value for the User field, all the results are gone. The help for the &lt;CODE&gt;search&lt;/CODE&gt; command makes it look like it needs to be more like &lt;CODE&gt;search NOT Command!="transfer *"&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 14:30:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340479#M100990</guid>
      <dc:creator>_smp_</dc:creator>
      <dc:date>2017-09-20T14:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340480#M100991</link>
      <description>&lt;P&gt;Looks like my posted code was missing an end quote to the prior &lt;CODE&gt;rex&lt;/CODE&gt;.  Did you catch that?  If not, pick it up and try again.&lt;/P&gt;

&lt;P&gt;The match looks okay to me.  Default is unanchored, meaning if it matches any subset of the field, it matches.  Syntax is regex, so your example would require there to be all spaces after transfer.  You could do "^transfer" or "^transfer.*" if you wanted, both of which would be equivalent.  Probably the first of those two would be the most efficient for your particular messages, but I didn't know what else you might need, and figured you sounded able to work it out.  Try something, test, believe the results, but keep a grain of salt handy.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/ConditionalFunctions"&gt;http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/ConditionalFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 18:28:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340480#M100991</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-20T18:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340481#M100992</link>
      <description>&lt;P&gt;Yes I caught it, didn't want to be nit-picky &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; You know, don't bite the hand that feeds you...&lt;/P&gt;

&lt;P&gt;Still toying with &lt;CODE&gt;match()&lt;/CODE&gt; in a &lt;CODE&gt;|search NOT&lt;/CODE&gt; command. The documentation you referred me to says it applies to &lt;CODE&gt;eval&lt;/CODE&gt;,&lt;CODE&gt;fieldsearch&lt;/CODE&gt; and &lt;CODE&gt;where&lt;/CODE&gt;, but not &lt;CODE&gt;search&lt;/CODE&gt;. I have found in my testing that when I use it in &lt;CODE&gt;search&lt;/CODE&gt; all my results are gone as though it's being treated as a literal string. That's what I suspect, but I haven't convinced myself yet.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 19:07:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340481#M100992</guid>
      <dc:creator>_smp_</dc:creator>
      <dc:date>2017-09-20T19:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Stats table manipulation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340482#M100993</link>
      <description>&lt;P&gt;So we can all play along:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval raw="_time=\"09-14-2017,13:13:32\",User=admin,Device=access-switch,CmdSet=\"switchport_access_vlan_600\" _time=\"09-14-2017,13:13:25\",User=admin,Device=access-switch,CmdSet=\"interface_GigabitEthernet_1/0/26\" _time=\"09-14-2017,13:13:57\",User=admin,Device=access-switch,CmdSet=\"no_shutdown\" _time=\"09-14-2017,13:13:56\",User=admin,Device=access-switch,CmdSet=\"shutdown\" _time=\"09-14-2017,17:36:08\",User=admin,Device=core-router,CmdSet=\"transfer_upload_start\" _time=\"09-14-2017,17:36:08\",User=admin,Device=core-router,CmdSet=\"transfer_upload_password_&amp;lt;hidden&amp;gt;\" _time=\"09-14-2017,17:36:08\",User=admin,Device=core-router,CmdSet=\"transfer_upload_Username_transfer\" _time=\"09-14-2017,17:36:07\",User=admin,Device=core-router,CmdSet=\"transfer_upload_filename_core-router-confg\" _time=\"09-14-2017,17:36:07\",User=admin,Device=core-router,CmdSet=\"transfer_upload_serverip_10.10.10.1\" _time=\"09-14-2017,17:36:07\",User=admin,Device=core-router,CmdSet=\"transfer_upload_datatype_config\" _time=\"09-14-2017,17:36:06\",User=admin,Device=core-router,CmdSet=\"transfer_upload_port_21\" _time=\"09-14-2017,17:36:06\",User=admin,Device=core-router,CmdSet=\"transfer_upload_mode_ftp\""
| makemv raw
| mvexpand raw
| rename raw AS _raw
| rex mode=sed "s/,/ /g"
| kv
| eval _time=strptime(time, "%m-%d-%Y %H:%M:%S")
| fields - time
| rex field=CmdSet mode=sed "s/_/ /g"
| rename COMMENT AS "Everything above generates sample event data; everything below is the solution"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You need to sort your events before you &lt;CODE&gt;stats&lt;/CODE&gt; them so this solves question #2:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| sort 0 _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This part is OK with a bit of adjustment:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Device=(if(isnull(Device),Address,Device))
| eval Time=strftime(_time,"%H:%M:%S")
| eval Date=strftime(_time, "%m-%d-%Y")
| stats list(CmdSet) AS Command, list(Time) AS Time earliest(CmdSet) AS firstCommand BY Date,User,Device
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As far as #1 and "eliminate rows /AFTER/ the stats command where the Command starts with 'transfer upload' or any number of other command snippets", it depends on what you mean by "rows" and "starts with".  I will assume you really mean rows, not lines in the "list" fields and that you mean "the first command in time-sequence".  If so, you can do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where NOT match(firstCommand, "(?:^transfer)|(?:foo$)|bar")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you mean "remove some of the commands in the list but keep the row", then you can do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Command=mvfilter(NOT match(firstCommand, "(?:^transfer)|(?:foo$)|bar"))
| where mvcount(Command)&amp;gt;0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regarding #3, modifying the limit is not that great an idea but if you keep in the order of magnitude (&amp;lt;1000), that should be OK.  The only other option would be to use &lt;CODE&gt;streamstats&lt;/CODE&gt; to mark batches of commands (first 100 get &lt;CODE&gt;groupOfHundreds="1-100"&lt;/CODE&gt;, the next 100 get &lt;CODE&gt;groupOfHundreds="101-200"&lt;/CODE&gt; and then do 2 stats in a row, one to roll up the groups of 100s and then do a &lt;CODE&gt;nomv&lt;/CODE&gt; and a second stats to list those.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Nov 2017 17:23:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-table-manipulation/m-p/340482#M100993</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-11-25T17:23:09Z</dc:date>
    </item>
  </channel>
</rss>

