Based on you wanting this to Just Work™, take a look at using a case() statement.
Here's a sample with the two ranges done:
| makeresults
| eval h=strftime(_time,"%H"), mr=strftime(_time,"%m")
| eval filter=case((h=16 OR (h=17 AND m<31)),"1",(h=18 OR (h=17 AND m>30)),"2",1=1,"you forgot to fill-in a range")
This breaks down as the following:
if the hour is 16 (4p), or it's 17 (5p) and less than or equal to half-past, return 1
if the hour is 18 (6p), or it's 17 (5p) and after half-past, return 2
the 1=1... segment is the default case: ie, if you missed a range, you'll get the 'error message'
Once you calculate your filter , use it in your sample search thusly:
<search>
| <filter logic using case statement>
| where like(abc,'filter')
<rest of search>
Adjust and extend as desired
edited to change from | search abc='filter' to | where like(abc,'filter')
... View more