<?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: Measuring time difference between 2 entries in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690628#M235207</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/269000"&gt;@Silah&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I saw your second messge only after my answer, plese try this:&lt;/P&gt;&lt;P&gt;Let me understand: what's the value of status in Begin and End events?&lt;/P&gt;&lt;P&gt;You have to check these conditions in the evals:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index status IN ("Begin", "End")
| stats
     earliest(eval(if(status="Begin",_time,""))) AS Begin_time
     latest(eval(if(status="End",_time,""))) AS End_time
     BY UUID
| eval diff=End_time-Begin_time
| table UUID diff&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2024 14:11:39 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2024-06-13T14:11:39Z</dc:date>
    <item>
      <title>Measuring time difference between 2 entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690616#M235200</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am getting a log feed for a transactional system. Each log entry has a status either End, Begin or something in between (but for this I don't care about the in between) and a UUID to mark that they belong to the same transaction.&lt;/P&gt;&lt;P&gt;I am struggling to write a search query that essentially subtracts the _time from the BEGIN entry ud UUID123, from the _time from the END entry with the same UUID. Obviously, my goal is to get the time it took the transaction to complete but I am not sure how to compare fields in two entries with the same UUID.&lt;/P&gt;&lt;P&gt;Any ideas ?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 13:35:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690616#M235200</guid>
      <dc:creator>Silah</dc:creator>
      <dc:date>2024-06-13T13:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Measuring time difference between 2 entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690618#M235201</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/269000"&gt;@Silah&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you could try to run something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index status IN (Begin, End)
| stats
     earliest(eval(status="Begin")) AS Begin_time
     latest(eval(status="End")) AS End_time
     BY UUID
| eval diff=End_time-Start_time
| table UUID diff&lt;/LI-CODE&gt;&lt;P&gt;then you can manage the incomplete conditions: e.g. there's only one event (Start or End)&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 13:43:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690618#M235201</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-06-13T13:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Measuring time difference between 2 entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690623#M235204</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you, this gets me started.&lt;/P&gt;&lt;P&gt;I assume that&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval diff=End_time-Start_time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;should actually be&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval diff=End_time-Begin_time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;as it is called Begin_time in the earliest eval of the Begin event in the Stats part&lt;/P&gt;&lt;P&gt;It does sort of work, My search query is identifying 4000 events and the table lists out 2000 by their UUID, so it has accurately identified that there is a Begin and End pair for each UUID, however the "diff" field of the table is blank for all of them.&lt;/P&gt;&lt;P&gt;When I check the field, the value of diff is "null".&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 13:59:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690623#M235204</guid>
      <dc:creator>Silah</dc:creator>
      <dc:date>2024-06-13T13:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Measuring time difference between 2 entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690624#M235205</link>
      <description>&lt;P&gt;Sorry I should have added that I tried listing the begin_time and end_time in the table also, and both values are simply "True" and not a time stamp&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 14:01:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690624#M235205</guid>
      <dc:creator>Silah</dc:creator>
      <dc:date>2024-06-13T14:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Measuring time difference between 2 entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690626#M235206</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/269000"&gt;@Silah&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;yes, it was a mistake!&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index status IN ("Begin", "End")
| stats
     earliest(eval(status="Begin")) AS Begin_time
     latest(eval(status="End")) AS End_time
     BY UUID
| eval diff=End_time-Begin_time
| table UUID diff&lt;/LI-CODE&gt;&lt;P&gt;anyway, you ha ve to separately check the two conditions (status="Begin" and status="End") to verify that you have in those events the status and UUID fields.&lt;/P&gt;&lt;P&gt;You can also add to the final table command also the&amp;nbsp; Begin_time and End_time fields to see if they are present or not.&lt;/P&gt;&lt;P&gt;Remember to use always quotes in the eval commands.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 14:07:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690626#M235206</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-06-13T14:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Measuring time difference between 2 entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690628#M235207</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/269000"&gt;@Silah&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I saw your second messge only after my answer, plese try this:&lt;/P&gt;&lt;P&gt;Let me understand: what's the value of status in Begin and End events?&lt;/P&gt;&lt;P&gt;You have to check these conditions in the evals:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index status IN ("Begin", "End")
| stats
     earliest(eval(if(status="Begin",_time,""))) AS Begin_time
     latest(eval(if(status="End",_time,""))) AS End_time
     BY UUID
| eval diff=End_time-Begin_time
| table UUID diff&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 14:11:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690628#M235207</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-06-13T14:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Measuring time difference between 2 entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690629#M235208</link>
      <description>&lt;P&gt;This worked perfectly. Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp; really appreciate your help.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 14:15:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690629#M235208</guid>
      <dc:creator>Silah</dc:creator>
      <dc:date>2024-06-13T14:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Measuring time difference between 2 entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690631#M235210</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/269000"&gt;@Silah&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 14:32:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690631#M235210</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-06-13T14:32:09Z</dc:date>
    </item>
  </channel>
</rss>

