I didn't try to digest your search, but i think relative_time() is your friend here. Quick question just to verify though, in your post do you mean that if the ticket is created Monday at 9pm it should start on TUESDAY at 8am?
Not well tested but i think it should mostly work. If the ticket comes in off hours (hour >=20, hour< 8 ) or over the weekend (day 5/6/0), then adjust the start to the next work day at 8am. Get the initial end time by adding the appropriate hours based on the sla, then figure out how far past the 8pm that is. Again, check the day and adjust appropriately for off-hours/weekend and finally add the remainder back.
So if I didn't make any mistakes, this should result in start and end fields containing the official start and end times based on when the ticket came in and the SLA...using ctime()/table at the end to just see if the dates look right.
index="test" sourcetype="incident_all_v3"
| eval start_hour = tonumber(strftime(relative_time(_time, "@h"),"%H")), start_day=tonumber(strftime(relative_time(_time,"@d"),"%w"))
| eval start = case(start_day=0 OR start_day=6 OR (start_day=5 AND start_hour>=20),relative_time(_time,"+1w@w1+8h"),start_hour < 8, relative_time(_time,"@d+8h"), start_hour>=20,relative_time(_time,"+1d@d+8h"), true(), _time)
| eval end = if(SLA = "SLA Level 1",relative_time(start,"+4h"), relative_time(start,"+8h")), end_hour = tonumber(strftime(end,"%H")), end_day = tonumber(strftime(end,"%w")), end_rem = end - relative_time(start,"@d+20h"), end_rem = if(end_rem <0, 0, end_rem)
| eval end = case(end_day = 6, relative_time(end, "+1w@w1+8h"), end_hour >=20, relative_time(end,"+1d@d+8h"), end_hour < 8, relative_time(end,"@d+8h"), true(),end), end = end + end_rem
| convert ctime(start), ctime(end)
| table start, end, SLA
... View more