As @FelixLeh said, usually there must be some transaction identified which bind those event to the same physical event. You said that in this case it is a day. So we can do it by this way index=anIndex sourcetype=aSourceType aString1 ("START of script" OR "COMPLETED OK")
| eval startTimeRaw = if (match(_raw, "START of script"), _time, null()),
endTimeRaw = if (match(_raw, "COMPLETED OK"), _time, null())
| bin span=1d _time as trcId
| stats range(_time) as duration values(startTimeRaw) as startTimeRaw values(endTimeRaw) as endTimeRaw by trcId
| eval durationHuman = tostring (duration, "duration")
| table trcId, startTimeRaw, endTimeRaw This divide events to 1 day slots and within those slots it calculate duration between start and end events. Probably you need to check that duration > 0 and if need take abs for it to get it right direction.
... View more