<?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: Sonicwall VPN group by field then sum of a field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Sonicwall-VPN-group-by-field-then-sum-of-a-field/m-p/493361#M137612</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval _raw="CN   Start_Time        SourceIP       End_Time          Dura(minutes)
Thor 03/16/20-12:20:46 xxx.xxx.xx.xxx 03/16/20-12:59:02 38
Thor 03/16/20-12:58:57 xxx.xxx.xx.xxx 03/16/20-13:08:14 9
Thor 03/16/20-13:08:21 xxx.xxx.xx.xxx 03/16/20-13:10:11 2
Thor 03/16/20-13:10:18 xxx.xxx.xx.xxx 03/16/20-13:12:02 2
Thor 03/16/20-13:12:05 xxx.xxx.xx.xxx 03/16/20-13:17:40 6
Thor 03/16/20-13:17:46 xxx.xxx.xx.xxx 03/16/20-13:21:03 3
Thor 03/16/20-13:21:12 xxx.xxx.xx.xxx 03/16/20-14:12:57 52"
| multikv forceheader=1
| rename Dura_minutes_ AS "Dura(minutes)"

| rename COMMENT AS "everything above generates sample event data; everything below is your solution"

| rename "Dura(minutes)" AS Dura_minutes_
| foreach *Time [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = strptime(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, "%m/%d/%y-%H:%M:%S") ]
| stats min(Start_Time) AS Start_Time max(End_Time) AS End_Time sum(Dura_minutes_) AS "Dura(minutes)" BY CN
| fieldformat Start_Time = strftime(Start_Time, "%m/%d/%y-%H:%M:%S")
| fieldformat End_Time = strftime(End_Time, "%m/%d/%y-%H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 19 Mar 2020 18:29:49 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2020-03-19T18:29:49Z</dc:date>
    <item>
      <title>Sonicwall VPN group by field then sum of a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sonicwall-VPN-group-by-field-then-sum-of-a-field/m-p/493359#M137610</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;We are getting data from syslog for ssl vpn login. Here is a sample log.&lt;/P&gt;

&lt;P&gt;,,"'0'",,"'-'",,"Thor","'Tunnel'","MCU","'192.168.1.8:0'",,,"'14711'","'197'","'-'","'0'",,,,"Restricted Users"&lt;BR /&gt;
,"'W'",,"'0x101'","'[::ffff:xxx.xxx.xx.xxx]:13996'","'11343'",,&lt;BR /&gt;
,"'(Thor)@(BRANCH) (CN=Thor,OU=Restricted Users,OU=MCU (VDI),OU=MCU,DC=MCU,DC=com)'","'-'"&lt;BR /&gt;
,"Mar 16 03:21:03 192.168.2.92 Mar 16 13:21:03 SSLVPN02 logserver: [16/Mar/2020:13:21:03.645800 +0300] &lt;BR /&gt;
ADMSSLVPN02 000000 kt 00000000 Info    Audit   Src='[::ffff:xxx.xxx.xx.xxx]:13996' Auth='-' &lt;BR /&gt;
User='(Thor)@(BRANCH) (CN=Thor,OU=Restricted Users,OU=MCU (VDI),OU=MCU,DC=MCU,DC=com)' SocksVersion='0x101' Command='Tunnel' &lt;BR /&gt;
Dest='192.168.3.80:0' Error='0' SrcBytes='11343' DstBytes='14711' Duration='197' VirtualHost='-' PlatformPrefix='W' EquipmentId='-' &lt;BR /&gt;
AppNumber='0'","2020-03-16T13:21:03.000-0700",,3,16,21,march,3,monday,2020,local,,,,"192.168.2.92",main,,1,,,logserver&lt;BR /&gt;
,"&lt;STRONG&gt;::_...&lt;/STRONG&gt;&lt;EM&gt;::&lt;/EM&gt;&lt;EM&gt;:&lt;/EM&gt;[//:::.&lt;EM&gt;+]&lt;/EM&gt;___________='[:::...]:","udp:514",syslog,"Splunk-WIN",,15,0&lt;/P&gt;

&lt;P&gt;Here is the query I've written.&lt;/P&gt;

&lt;P&gt;extracted_source="udp:514" Duration="&lt;EM&gt;" Tunnel CN="Appa&lt;/EM&gt;" | rex field=Duration "\'(?P.+)\'" | rex field=Src ":(?P.+):" | eval Start_Time = strftime(strptime(time, "%Y-%m-%dT%H:%M:%S")-Duration, "%D-%T") | eval Duration(minutes)=Round(Duration/60) | eval End_Time = strftime(strptime(time, "%Y-%m-%dT%H:%M:%S"), "%D-%T") | eval User=CN | eval SourceIP=replace (SourceIP, ":ffff:", "") | eval SourceIP=replace (SourceIP, "]", "") | table CN,Start_Time,SourceIP,End_Time,Duration(minutes)&lt;/P&gt;

&lt;P&gt;this gives me a result like this.&lt;/P&gt;

&lt;P&gt;CN  Start_Time  SourceIP    End_Time    Dura(minutes)&lt;BR /&gt;
Thor    03/16/20-12:20:46   xxx.xxx.xx.xxx  03/16/20-12:59:02   38&lt;BR /&gt;
Thor    03/16/20-12:58:57   xxx.xxx.xx.xxx  03/16/20-13:08:14   9&lt;BR /&gt;
Thor    03/16/20-13:08:21   xxx.xxx.xx.xxx  03/16/20-13:10:11   2&lt;BR /&gt;
Thor    03/16/20-13:10:18   xxx.xxx.xx.xxx  03/16/20-13:12:02   2&lt;BR /&gt;
Thor    03/16/20-13:12:05   xxx.xxx.xx.xxx  03/16/20-13:17:40   6&lt;BR /&gt;
Thor    03/16/20-13:17:46   xxx.xxx.xx.xxx  03/16/20-13:21:03   3&lt;BR /&gt;
Thor    03/16/20-13:21:12   xxx.xxx.xx.xxx  03/16/20-14:12:57   52&lt;/P&gt;

&lt;P&gt;I need to make it concise. Desired output I'm trying to get will look like this.&lt;/P&gt;

&lt;P&gt;CN  Start_Time  End_Time    Dura(minutes)&lt;BR /&gt;
Thor    03/16/20-12:20:46   03/16/20-14:12:57   112&lt;/P&gt;

&lt;P&gt;CN = UserName&lt;BR /&gt;
Start_Time = first session's timestamp&lt;BR /&gt;
End_Time = last session's timestamp&lt;BR /&gt;
Dura(minutes) = sum of duration of all sessions&lt;/P&gt;

&lt;P&gt;How can I achieve this.?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:35:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sonicwall-VPN-group-by-field-then-sum-of-a-field/m-p/493359#M137610</guid>
      <dc:creator>mashhoorgulati</dc:creator>
      <dc:date>2020-09-30T04:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Sonicwall VPN group by field then sum of a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sonicwall-VPN-group-by-field-then-sum-of-a-field/m-p/493360#M137611</link>
      <description>&lt;P&gt;Hi @mashhoorgulati,&lt;/P&gt;

&lt;P&gt;Add this to the end of your query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your query&amp;gt; | rename Duration(minutes) as Duration | stats min(Start_Time) as Start_Time, max(End_Time) as End_Time, sum(Duration) as Duration(minutes) by CN
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Mar 2020 13:04:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sonicwall-VPN-group-by-field-then-sum-of-a-field/m-p/493360#M137611</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-03-19T13:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sonicwall VPN group by field then sum of a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sonicwall-VPN-group-by-field-then-sum-of-a-field/m-p/493361#M137612</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval _raw="CN   Start_Time        SourceIP       End_Time          Dura(minutes)
Thor 03/16/20-12:20:46 xxx.xxx.xx.xxx 03/16/20-12:59:02 38
Thor 03/16/20-12:58:57 xxx.xxx.xx.xxx 03/16/20-13:08:14 9
Thor 03/16/20-13:08:21 xxx.xxx.xx.xxx 03/16/20-13:10:11 2
Thor 03/16/20-13:10:18 xxx.xxx.xx.xxx 03/16/20-13:12:02 2
Thor 03/16/20-13:12:05 xxx.xxx.xx.xxx 03/16/20-13:17:40 6
Thor 03/16/20-13:17:46 xxx.xxx.xx.xxx 03/16/20-13:21:03 3
Thor 03/16/20-13:21:12 xxx.xxx.xx.xxx 03/16/20-14:12:57 52"
| multikv forceheader=1
| rename Dura_minutes_ AS "Dura(minutes)"

| rename COMMENT AS "everything above generates sample event data; everything below is your solution"

| rename "Dura(minutes)" AS Dura_minutes_
| foreach *Time [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = strptime(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, "%m/%d/%y-%H:%M:%S") ]
| stats min(Start_Time) AS Start_Time max(End_Time) AS End_Time sum(Dura_minutes_) AS "Dura(minutes)" BY CN
| fieldformat Start_Time = strftime(Start_Time, "%m/%d/%y-%H:%M:%S")
| fieldformat End_Time = strftime(End_Time, "%m/%d/%y-%H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Mar 2020 18:29:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sonicwall-VPN-group-by-field-then-sum-of-a-field/m-p/493361#M137612</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-19T18:29:49Z</dc:date>
    </item>
  </channel>
</rss>

