{"id":54174,"date":"2022-04-04T13:32:03","date_gmt":"2022-04-04T13:32:03","guid":{"rendered":"https:\/\/merikebi.warrenmyers.com\/?p=54174"},"modified":"2022-04-04T13:32:03","modified_gmt":"2022-04-04T13:32:03","slug":"answer-by-warren-for-how-to-show-the-time-difference-between-two-events-in-a-splunk-join-query","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=54174","title":{"rendered":"Answer by warren for How to show the time difference between two events in a Splunk join query?"},"content":{"rendered":"<p>Fairly confident something akin to this should work (without using <code>join<\/code>:<\/p>\n<pre><code>index=ndx sourtype=srctp uuid=* msg=*\n| stats min(_time) as first_time max(_time) as last_time earliest(msg) as first_msg latest(msg) as last_msg by uuid\n| eval diff_seconds=last_time-first_time\n| eval first_time=strftime(first_time,&quot;%c&quot;), last_time=strftime(last_time,&quot;%c&quot;)\n<\/code><\/pre>\n<p>This approach will presume that <code>_time<\/code> has been set properly in the sourcetype&#8217;s <code>props.conf<\/code>, but if it has, this gets you what you&#8217;re looking for in one pass.<\/p>\n<p>from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/71719391\/how-to-show-the-time-difference-between-two-events-in-a-splunk-join-query\/71738005#71738005<br \/>\nvia <a href=\"https:\/\/ifttt.com\/?ref=da&#038;site=wordpress\">IFTTT<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fairly confident something akin to this should work (without using join: index=ndx sourtype=srctp uuid=* msg=* | stats min(_time) as first_time max(_time) as last_time earliest(msg) as first_msg latest(msg) as last_msg by uuid | eval diff_seconds=last_time-first_time | eval first_time=strftime(first_time,&quot;%c&quot;), last_time=strftime(last_time,&quot;%c&quot;) This approach will presume that _time has been set properly in the sourcetype&#8217;s props.conf, but if it &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=54174\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Answer by warren for How to show the time difference between two events in a Splunk join query?<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[991],"keyring_services":[],"class_list":["post-54174","post","type-post","status-publish","format-standard","hentry","category-blih","tag-stackexchange"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/54174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=54174"}],"version-history":[{"count":1,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/54174\/revisions"}],"predecessor-version":[{"id":54175,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/54174\/revisions\/54175"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=54174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=54174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=54174"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=54174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}