<?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 calculate duration between two events and plot this on a bar chart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265359#M79754</link>
    <description>&lt;P&gt;You need a common field or you need to join the transaction with time dependency which might also not work for you. Try extracting the SERIAL as different fields and then create a field alias and use the field alias in transaction&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2016 04:07:11 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2016-02-04T04:07:11Z</dc:date>
    <item>
      <title>How to calculate duration between two events and plot this on a bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265354#M79749</link>
      <description>&lt;P&gt;HI All,&lt;/P&gt;

&lt;P&gt;I am hoping one of you can help me figure out how to calculate time duration between the below sample events.  These are the two events that get logged when a session is being blocked on DB server and the other when the alert gets cleared. I would like to create a bar chart showing the time duration of each blocking events. Thanks.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;TIMESTAMP=Oct 2, 2015 2:57:57 AM EDT&lt;BR /&gt;
Host=sysdb-ux01.xxx.com&lt;BR /&gt;
Message=Total db time 223 seconds is consumed by 1 sessions blocked by session SID,SERIAL:268,23207,LOCK_TYPE:TX,PROGRAM:sqlplus@sysdb-ux01 (TNS V1-V3),MODULE:sqlplus@sysdb-ux01 (TNS V1-V3),ACTION:XXX_PROGRAM,MACHINE:sysdb-ux01,OSUSER:oracle,USERNAME:SYS.&lt;BR /&gt;
Target_Type=Database Instance&lt;BR /&gt;
Target_Name=DB_01&lt;BR /&gt;
Severity=Critical&lt;BR /&gt;
Metric=db_time&lt;BR /&gt;
Num_Keys=1&lt;BR /&gt;
Key_Value_Name=db_time_id__&lt;/P&gt;

&lt;H2&gt;Key_Value=223___&lt;/H2&gt;

&lt;P&gt;TIMESTAMP=Oct 2, 2015 3:02:57 AM EDT&lt;BR /&gt;
Host=sysdb-ux01.xxx.com&lt;BR /&gt;
Message=Alert for Blocking Session DB Time for 4980745_756827_268_23207 is cleared&lt;BR /&gt;
Target_Type=Database Instance&lt;BR /&gt;
Target_Name=DB_01&lt;BR /&gt;
Severity=Clear&lt;BR /&gt;
Metric=db_time&lt;BR /&gt;
Num_Keys=1&lt;BR /&gt;
Key_Value_Name=db_time_id__&lt;BR /&gt;
Key_Value=___&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:39:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265354#M79749</guid>
      <dc:creator>saurabhkunte</dc:creator>
      <dc:date>2020-09-29T08:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate duration between two events and plot this on a bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265355#M79750</link>
      <description>&lt;P&gt;You can use &lt;CODE&gt;transaction&lt;/CODE&gt; command &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/Transaction"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search | transaction Host,Target_Name, "other common unique fields for these two transaction" startswith="sessions blocked by session" endswith="is cleared"|timechart duration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or use &lt;CODE&gt;stats&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search|stats first(_time) as End,last(_time) as Start by "common unique fields in the transaction"|eval Difference=End-Start|chart Difference
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You might need to adjust the time format for time difference in the second one.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 09:18:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265355#M79750</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-02-03T09:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate duration between two events and plot this on a bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265356#M79751</link>
      <description>&lt;P&gt;Thanks Renjith.nair.&lt;/P&gt;

&lt;P&gt;However this is grouping the next event in series. The events have common SERIAL IDs in both the events. &lt;BR /&gt;
For e.g SERIAL:23207 in the event which alerts blocking of session\&lt;BR /&gt;
23207 - in the event which displays the blocking was cleared.&lt;/P&gt;

&lt;P&gt;How do i use these common values to group the events? &lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 10:07:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265356#M79751</guid>
      <dc:creator>saurabhkunte</dc:creator>
      <dc:date>2016-02-03T10:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate duration between two events and plot this on a bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265357#M79752</link>
      <description>&lt;P&gt;If it's not a field, extract it and use it in transaction&lt;BR /&gt;
ie&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; your search | transaction SERIAL startswith="sessions blocked by session" endswith="is cleared"|timechart duration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; your search|stats first(_time) as End,last(_time) as Start by SERIAL|eval Difference=End-Start|timechart Difference
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Feb 2016 12:31:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265357#M79752</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-02-03T12:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate duration between two events and plot this on a bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265358#M79753</link>
      <description>&lt;P&gt;The problem is the Numeric serials are in 2 different events. When I use IFX it extracts Numeric values for the field from only one event and does not allow me to extract values for same field from the other event. So I am unable to group the events using transaction command for the common field I am trying to extract.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 17:54:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265358#M79753</guid>
      <dc:creator>saurabhkunte</dc:creator>
      <dc:date>2016-02-03T17:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate duration between two events and plot this on a bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265359#M79754</link>
      <description>&lt;P&gt;You need a common field or you need to join the transaction with time dependency which might also not work for you. Try extracting the SERIAL as different fields and then create a field alias and use the field alias in transaction&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 04:07:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265359#M79754</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-02-04T04:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate duration between two events and plot this on a bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265360#M79755</link>
      <description>&lt;P&gt;Trying the first method:&lt;BR /&gt;
    ...&lt;BR /&gt;
    | transaction host, PID startswith="Code=ImportRequestStart" endswith="Code=ImportRequestEnd"&lt;BR /&gt;
    | timechart duration&lt;/P&gt;

&lt;P&gt;I get this error: &lt;CODE&gt;Error in 'timechart' command: The specifier 'duration' is invalid. It must be in form &amp;lt;func&amp;gt;(&amp;lt;field&amp;gt;). For example: max(size).&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Using &lt;CODE&gt;avg(duration)&lt;/CODE&gt; works...&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 20:11:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-duration-between-two-events-and-plot-this-on-a/m-p/265360#M79755</guid>
      <dc:creator>unitedmarsupial</dc:creator>
      <dc:date>2019-12-04T20:11:38Z</dc:date>
    </item>
  </channel>
</rss>

