Splunk Search

Calculate Date Diff - two different events in the two different sourcetypes

erick_costa
Path Finder
sourcetype=teste1
============================
code, datahora
_________________
1, 2013-05-07 15:51:13.772

sourcetype=teste2
============================
code, datahora
_________________
1, 2013-05-07 15:55:13.060
Tags (2)
0 Karma

aholzer
Motivator

Perform an eval "strptime" on both dates, or a convert with timeformat, then simply use another eval to do the subtraction.

Something like this from this answer (http://splunk-base.splunk.com/answers/10021/delta-between-two-date-data-fields):
...| convert timeformat='%m-%d-%Y %T' mktime(starttime) mktime(endtime) | eval duration=(endtime-starttime)/86400

There are quite a few different ways to do it. If you search for "splunk difference between two dates", or "splunk subtracting two dates" or similar, you should get quite a few answers to your question.

erick_costa
Path Finder

How to calculate datediff?

0 Karma

Ayn
Legend

Yes? Did you have a question?

Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...