<?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 do I do both filtering and grouping on a timechart? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-do-both-filtering-and-grouping-on-a-timechart/m-p/194933#M38797</link>
    <description>&lt;P&gt;Thank you for your answer.&lt;/P&gt;

&lt;P&gt;It helped me a lot but I still have some questions in order to really acheive my goal:&lt;BR /&gt;
- How can I represent these search in a timechart for the last 24 hours or more?&lt;BR /&gt;
- How can I use the DeviceCategory field as a parameter of the search that can be changed by the user? For example, if i want to group the events by DeviceManufacturer or Drivername or Just None instead?&lt;/P&gt;</description>
    <pubDate>Sun, 18 Jan 2015 17:03:27 GMT</pubDate>
    <dc:creator>np75014</dc:creator>
    <dc:date>2015-01-18T17:03:27Z</dc:date>
    <item>
      <title>How do I do both filtering and grouping on a timechart?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-do-both-filtering-and-grouping-on-a-timechart/m-p/194931#M38795</link>
      <description>&lt;P&gt;My Splunk server is being forwarded events from a remote Windows machine. Those events correspond to device connections and disconnections. Each event corresponds to either a connection or disconnection.&lt;/P&gt;

&lt;P&gt;I have a CSV file containing information about those devices. The CSV file's headers looks like this:&lt;BR /&gt;
DriverName,DeviceManufacturer,DriverVersion,DeviceModel,DeviceCategory&lt;/P&gt;

&lt;P&gt;Only DeviceManufacturer and DeviceModel information are available in the forwarded events. The others are not.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;This is what I need to do:&lt;/STRONG&gt;&lt;BR /&gt;
** 1.** Display on a timechart the connected devices for every hour during the last day.&lt;BR /&gt;
 &lt;STRONG&gt;2.&lt;/STRONG&gt; Filter the displayed data by one or more of the fields of the CSV file that are listed above.&lt;BR /&gt;
 &lt;STRONG&gt;3.&lt;/STRONG&gt; Provide the options to group the displayed data by one of the same fields of the CSV file that are listed above.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;BR /&gt;
List the connected devices every hour during the last day filtered by DeviceManufacturer=X and DeviceModel=Y, grouped by DeviceCategory (See &lt;A href="http://www.filedropper.com/image_5"&gt;example&lt;/A&gt;).&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;For now I managed to do points 1 and 2, but I cannot combine them with point 3. (I can display the timechart and filter by fields but cannot combine them with the grouping).&lt;/STRONG&gt;&lt;BR /&gt;
I did this using the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=DRIVER_STATUS_CHANGED | rex "Message=(?.+?) status changed from (?.+?) to (?.+?)\." 
| eval counter=case(to_status="Connected", 1, from_status="Connected", -1, 1==1, 0) 
| timechart span=1m sum(counter) as counter 
| streamstats sum(counter) as counter | eventstats min(counter) as min 
| eval counter=if(min &amp;lt; 0, counter + (min*-1), counter) | fields - min
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jan 2015 10:10:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-do-both-filtering-and-grouping-on-a-timechart/m-p/194931#M38795</guid>
      <dc:creator>np75014</dc:creator>
      <dc:date>2015-01-16T10:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do both filtering and grouping on a timechart?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-do-both-filtering-and-grouping-on-a-timechart/m-p/194932#M38796</link>
      <description>&lt;P&gt;Sorry, I could not see your image at &lt;A href="http://www.filedropper.com/image_5"&gt;http://www.filedropper.com/image_5&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;And something is definitely wrong with the rex command in the your question - it isn't extracting any fields. So I think there may be a cut-and-paste problem there... Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=DRIVER_STATUS_CHANGED DeviceManufacturer=X and DeviceModel=Y
| rex "Message=(?.+?) status changed from (?&amp;lt;from_status&amp;gt;?.+?) to (?&amp;lt;to_status&amp;gt;?.+?)\." 
| lookup device_lookup DeviceManufacturer DeviceModel
| eval counter=case(to_status="Connected", 1, from_status="Connected", -1, 1==1, 0) 
| bucket span=1m _time
| stats sum(counter) as counter by DeviceCategory _time
| eventstats min(counter) as min by DeviceCategory
| eval counter=if(min &amp;lt; 0, counter + (min*-1), counter) | fields - min
| xyseries _time DeviceCategory counter
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can find more information about Lookups &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Usefieldlookupstoaddinformationtoyourevents"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 18:53:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-do-both-filtering-and-grouping-on-a-timechart/m-p/194932#M38796</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-01-16T18:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do both filtering and grouping on a timechart?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-do-both-filtering-and-grouping-on-a-timechart/m-p/194933#M38797</link>
      <description>&lt;P&gt;Thank you for your answer.&lt;/P&gt;

&lt;P&gt;It helped me a lot but I still have some questions in order to really acheive my goal:&lt;BR /&gt;
- How can I represent these search in a timechart for the last 24 hours or more?&lt;BR /&gt;
- How can I use the DeviceCategory field as a parameter of the search that can be changed by the user? For example, if i want to group the events by DeviceManufacturer or Drivername or Just None instead?&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jan 2015 17:03:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-do-both-filtering-and-grouping-on-a-timechart/m-p/194933#M38797</guid>
      <dc:creator>np75014</dc:creator>
      <dc:date>2015-01-18T17:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do both filtering and grouping on a timechart?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-do-both-filtering-and-grouping-on-a-timechart/m-p/194934#M38798</link>
      <description>&lt;P&gt;&lt;A href="https://www.dropbox.com/sh/voxr1p5uj6o1mgi/AAAeiYOLQUU8jtFqVTU8-xsBa?dl=0#lh:null-deviceutilizationexample.png"&gt;https://www.dropbox.com/sh/voxr1p5uj6o1mgi/AAAeiYOLQUU8jtFqVTU8-xsBa?dl=0#lh:null-deviceutilizationexample.png&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 09:04:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-do-both-filtering-and-grouping-on-a-timechart/m-p/194934#M38798</guid>
      <dc:creator>np75014</dc:creator>
      <dc:date>2015-01-20T09:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do both filtering and grouping on a timechart?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-do-both-filtering-and-grouping-on-a-timechart/m-p/194935#M38799</link>
      <description>&lt;P&gt;I still have several points to be clarified. First of all, how can this search be represented in a timechart? And I also want to group events by Drivername or None. I guess something's wrong in a command I'm trying. I'll try to check it thoroughly.&lt;BR /&gt;
Miles - Check &lt;A href="http://domyhomeworkonline.net/"&gt;http://domyhomeworkonline.net&lt;/A&gt;/ with Miles Preskott topic&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 11:13:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-do-both-filtering-and-grouping-on-a-timechart/m-p/194935#M38799</guid>
      <dc:creator>Miles333</dc:creator>
      <dc:date>2016-10-05T11:13:05Z</dc:date>
    </item>
  </channel>
</rss>

