
SO I took some help from a colleague of mine and got to this stage (please see below) and I am able to take two transactions into one field, but the time difference between those epoch values of two transactions are showing wrong. For example: in a day, if there are two failures, one at 3 AM and one at 8 PM, I am trying to create a graph and show the time between these two failures (which is 17 Hrs). I am simply trying to create a graph with the data for the time between every failure. The transactions contains success and failures and every transaction has an epoch timestamp for the transaction occurred. The data consists of epoch time (field name is " transactiontime") and the transaction values. eval daydiffround ( (now ()-time) / 86400, 0) Create a new field called daydiff, which is the difference between now and when the string executed, rounded to the nearest integer value.
Splunk eval time difference update#
Could you please advise whether this is how it works or is there a work-around to update the existing event.I am trying to derive a simple chart from the data I got here within a Splunk Index. Create a new field called cllength that shows the length of each command line string the search returns. I want to update the existing event from the saved_sourcetype, but it's insering it as newEvent.

But the update part is not working as I wish. I've adjusted the query and everything is working fine.

I do see the logic here taking the previous provided time and subtracting it from time (current time) which will give the time in between these two events. However the earlier query you provided actually is not providing output to eval deltatostring(time-prevtime, 'duration'). Calculate the speed by dividing the values in the distance field by the values in the time field. Yes the 'runanywhere sample' worked with output (Duration as '0'). Create a new field called speed in each event. Create a new field that contains the result of a calculation. See Quick Reference for SPL2 eval functions. I'm wondering how I missed that, really a good catch. Many of these examples use the evaluation functions. | stats count earliest(savedTime) as savedTime latest(Time) as Time values(Known) as Known first(host) as host last(source) as source by EventCode, SaveAction, insertRequired, UpdateRequired InsertRequired = "Yes" AND UpdateRequired != "Yes", "insert", | eval UpdateRequired=if(Time < savedTime, "Yes", "No") | eval insertRequired=if(Known=0, "Yes", "No") But, it does not do this by default with any additional timestamp-looking data within the event. | stats count as Known values(Time) as sTime values(host) as host values(source) as source by EventCode] Splunk (by default) parses out the first timestamp it sees from an event (well, it could be a different timestamp if you configure it this way) and stores it in timet format as the field time.

| join type=left EventCode [ search index=main sourcetype=saved_sourcetype | eval savedTime=strptime(Time, "%Y-%m-%d %H:%M:%S") | stats count earliest(_time) as Time first(host) as host first(source) as source by EventCode Any advise would be very much appreciated. But the below query fails to display the Time(SavedTime) from the saved sourcetype and my query is failing to update events. After that we have taken the difference between the two epochtime fields in Diff field.In the DiffD field we have converted the Diff field values into days and taken upto 2 decimal point by the round function.By the where command we have taken those data whose difference of Opened date and Closed date is above 5 days.By the sort com. If the event is there in sourcetype and the time is greater than the time from current search then I'm updating the event with the earliest event. If it's not in saved sourcetype, I'm inserting the event. I'm trying to store the results into a source_type and use the saved sourcetype to check whether the Event is already there in saved sourcetype or not.
