Thanks! It works after some adaptations.
PS: There is an error at variable enddtime1, the correct should be endtime1
The final code for my environment was something like this:
One observation: Because I'm using minutes to count the total SLA, the regular expression used to validate from 08 to 18 should stop as 17, because 17 means 17:00, 17:01 ....17:59.
index="my_app" p_id=635392908992408562
| transaction p_id
| eval starttime=_time
| eval endtime=_time+duration
| eval my_minutes=mvrange(starttime,endtime,60)
| convert ctime(my_minutes) timeformat="%Y-%m-%d %H:%M:%S"
| eval interestedMinutes=mvfilter(match(my_minutes,"( 08| 09| 10| 11| 12| 13| 14| 15| 16| 17).*"))
| eval SLA_Minutes=mvcount(interestedMinutes)
| eval SLA_Time=tostring(SLA_Minutes*60,"duration")
| eval h_starttime=strftime(starttime,"%Y-%m-%d %H:%M:%S")
| eval h_endtime=if(duration!=0, strftime(starttime+duration,"%Y-%m-%d %H:%M:%S"), "")
| eval h_duration=if(duration!=0, tostring(duration,"duration"), "")
| table p_id h_starttime h_endtime SLA_Time
... View more