<?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 get the total sum based on specific field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185209#M53385</link>
    <description>&lt;P&gt;Once you convert the duration field to a number (of seconds?), you can easily calculate the total duration with something like &lt;CODE&gt;stats sum(duration) AS total_time by Username&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 29 May 2014 13:27:34 GMT</pubDate>
    <dc:creator>sowings</dc:creator>
    <dc:date>2014-05-29T13:27:34Z</dc:date>
    <item>
      <title>how to get the total sum based on specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185208#M53384</link>
      <description>&lt;P&gt;I have a query which runs over a month period which lists all users connected via VPN and the duration of each connection.&lt;BR /&gt;
What I would like to do is list the amount of time each user is connected.&lt;BR /&gt;
I have the query:&lt;/P&gt;

&lt;P&gt;host=10.45.16.40 vpn/ "Session disconnected" | rex field=_raw "Duration(?&lt;DURATION&gt;[^,]*)" | stats count by Username duration which returns results:&lt;/DURATION&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Username                         duration          count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;1    vpn/&lt;A href="mailto:anna.ostren@ingostlm.e"&gt;anna.ostren@ingostlm.e&lt;/A&gt;  : 0h:27m:11s     1&lt;/P&gt;

&lt;P&gt;2    vpn/&lt;A href="mailto:anna.ostren@ingostlm.e"&gt;anna.ostren@ingostlm.e&lt;/A&gt;  : 1h:21m:17s     1&lt;/P&gt;

&lt;P&gt;3    vpn/&lt;A href="mailto:anna.ostren@ingostlm.e"&gt;anna.ostren@ingostlm.e&lt;/A&gt;  : 3h:06m:18s     1&lt;/P&gt;

&lt;P&gt;4    vpn/&lt;A href="mailto:annika.mll@ingostlm.e"&gt;annika.mll@ingostlm.e&lt;/A&gt;   : 0h:50m:25s     1&lt;/P&gt;

&lt;P&gt;5    vpn/&lt;A href="mailto:annika.mll@ingostlm.e"&gt;annika.mll@ingostlm.e&lt;/A&gt;   : 1h:44m:12s     1&lt;/P&gt;

&lt;P&gt;6    vpn/&lt;A href="mailto:at@unegy.k"&gt;at@unegy.k&lt;/A&gt;                  : 0h:11m:16s     1&lt;/P&gt;

&lt;P&gt;so I would like to combine all users of the same name and list the total time they were connected.&lt;/P&gt;

&lt;P&gt;Is this possible?&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 13:03:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185208#M53384</guid>
      <dc:creator>ikcresswell</dc:creator>
      <dc:date>2014-05-29T13:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the total sum based on specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185209#M53385</link>
      <description>&lt;P&gt;Once you convert the duration field to a number (of seconds?), you can easily calculate the total duration with something like &lt;CODE&gt;stats sum(duration) AS total_time by Username&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 13:27:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185209#M53385</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2014-05-29T13:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the total sum based on specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185210#M53386</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=10.45.16.40 vpn/ "Session disconnected" | rex field=_raw "Duration(?&amp;lt;duration&amp;gt;[^,]*)" | stats count by Username duration | rex field=duration "(?&amp;lt;Hour&amp;gt;.*)h:(?&amp;lt;Minute&amp;gt;.*)m:(?&amp;lt;Second&amp;gt;.*)s" | eval duration=Hour*3600 + Minute*60 + Second | stats sum(duration) as TotalDuration, sum(count) as SessionCount by Username
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 May 2014 13:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185210#M53386</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-29T13:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the total sum based on specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185211#M53387</link>
      <description>&lt;P&gt;that's very close it's just not converting the time to seconds so the TotalDuration field is empty.&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 14:06:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185211#M53387</guid>
      <dc:creator>ikcresswell</dc:creator>
      <dc:date>2014-05-29T14:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the total sum based on specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185212#M53388</link>
      <description>&lt;P&gt;that is almost working, its just not converting the time into seconds so the TotalDuration field is empty.&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 14:07:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185212#M53388</guid>
      <dc:creator>ikcresswell</dc:creator>
      <dc:date>2014-05-29T14:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the total sum based on specific field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185213#M53389</link>
      <description>&lt;P&gt;this worked for me, above solution helped me finish this off.&lt;BR /&gt;
host=10.45.16.40 vpn/ "Session disconnected" | rex field=_raw "Duration:(?&lt;DURATION&gt;[^,]*)" | stats count by Username duration | rex field=duration "(?&lt;HOUR&gt;(\d+))h:(?&lt;MINUTE&gt;(\d+))m:(?&lt;SECOND&gt;(\d+))s" | eval duration=Hour*3600 + Minute*60 + Second | stats sum(duration) as TotalDuration, sum(count) as SessionCount by Username&lt;/SECOND&gt;&lt;/MINUTE&gt;&lt;/HOUR&gt;&lt;/DURATION&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:45:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-the-total-sum-based-on-specific-field/m-p/185213#M53389</guid>
      <dc:creator>ikcresswell</dc:creator>
      <dc:date>2020-09-28T16:45:11Z</dc:date>
    </item>
  </channel>
</rss>

