<?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: Calculate duration in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633373#M220028</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="connect.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24196i7D5D5F2E26A02657/image-size/large?v=v2&amp;amp;px=999" role="button" title="connect.png" alt="connect.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="disconnect.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24194iCA2BA70A193E94D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="disconnect.png" alt="disconnect.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;there are 2 logs about connect and disconnect. Both of them have same filed is profile (jack_nguyen)&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2023 02:54:27 GMT</pubDate>
    <dc:creator>jacknguyen</dc:creator>
    <dc:date>2023-03-06T02:54:27Z</dc:date>
    <item>
      <title>How can I calculate duration?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633299#M220005</link>
      <description>&lt;P&gt;Hi I want to calculate duration. For example, I have 2 different event in a source&lt;BR /&gt;First event:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;04/03/2023&amp;nbsp; &amp;nbsp;PLUGIN_CLIENT_CONNECT (this is not a field in event)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;17:10:15.000&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Second event:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;04/03/2023&amp;nbsp; &lt;SPAN class=""&gt;PLUGIN_CLIENT&lt;/SPAN&gt;_&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;DISCONNECT&amp;nbsp; (this is not a field in event)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;17:51:15.000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I want to cal duration between them.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Expected result with table:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Start Time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; End Time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Hours Ago&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;04/03/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;04/03/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; 41 minutes (and hours if have)&amp;nbsp;&lt;BR /&gt;17:10:15.000&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;17:51:15.000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Anyone can help me??? Thank you for pay time&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 14:51:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633299#M220005</guid>
      <dc:creator>jacknguyen</dc:creator>
      <dc:date>2023-03-06T14:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633300#M220006</link>
      <description>&lt;P&gt;How to you correlate the two events? For example, is there a field (or at least data) in both events which uniquely ties the two events together?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval starttime=if(&amp;lt;PLUGIN_CLIENT_CONNECT&amp;gt;,_time,null())
| eval endtime=if(&amp;lt;PLUGIN_CLIENT_DISCONNECT&amp;gt;,_time,null())
| stats value(starttime) as starttime values(endtime) as endtime by &amp;lt;unique correlation value field&amp;gt;
| eval duration=endtime-starttime&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 04 Mar 2023 15:50:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633300#M220006</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-03-04T15:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633316#M220011</link>
      <description>&lt;P&gt;in both event I have field is profile. Howerver both of that were extracted in different time. I tried to use join fuction with "profile" but the start time and end time column is empty when I use table. And Hours Ago column was shown Null Hours&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2023 05:57:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633316#M220011</guid>
      <dc:creator>jacknguyen</dc:creator>
      <dc:date>2023-03-05T05:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633317#M220012</link>
      <description>&lt;P&gt;It is always difficult to provide a complete solution without exact details of the problem.&lt;/P&gt;&lt;P&gt;Please can you share the events (anonymised of course) in a code block &amp;lt;/&amp;gt; to preserve any formatting that may be present?&lt;/P&gt;&lt;P&gt;Also, please can you share the unsuccessful SPL you are using in case there is an error there?&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2023 07:50:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633317#M220012</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-03-05T07:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633373#M220028</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="connect.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24196i7D5D5F2E26A02657/image-size/large?v=v2&amp;amp;px=999" role="button" title="connect.png" alt="connect.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="disconnect.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24194iCA2BA70A193E94D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="disconnect.png" alt="disconnect.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;there are 2 logs about connect and disconnect. Both of them have same filed is profile (jack_nguyen)&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 02:54:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633373#M220028</guid>
      <dc:creator>jacknguyen</dc:creator>
      <dc:date>2023-03-06T02:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633398#M220035</link>
      <description>&lt;P&gt;Assuming the profile uniquely identifies the session you want to measure, try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "(?&amp;lt;event&amp;gt;PLUGIN_CLIENT_CONNECT|PLUGIN_CLIENT_DISCONNECT)"
| eval starttime=if(event=="PLUGIN_CLIENT_CONNECT",_time,null())
| eval endtime=if(event=="PLUGIN_CLIENT_DISCONNECT",_time,null())
| stats value(starttime) as starttime values(endtime) as endtime by profile
| eval duration=endtime-starttime&lt;/LI-CODE&gt;&lt;P&gt;If it doesn't, do you want another field value that does uniquely tie these events together?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 09:58:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-calculate-duration/m-p/633398#M220035</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-03-06T09:58:04Z</dc:date>
    </item>
  </channel>
</rss>

