I've looked into format and it doesn't look like I can replace the "=".
I want to change
( ( DateStart="12/14/2016" AND TimeEnd="1:38:27 PM" AND TimeStart="1:38:27 PM" ) )
to
( ( DateStart="12/14/2016" AND TimeEnd<"1:38:27 PM" AND TimeStart>"1:38:20 PM" ) )
Thanks in advance for any suggestions on how to fix this.
I'm on 6.4.3.
Updated answer - found a way, more or less -
| makeresults
| eval DateStart="12/14/2016" | eval TimeEnd="1:38:27 PM" |eval TimeStart="1:38:27 PM"
| table DateStart TimeStart TimeEnd
| format
| append
[| makeresults | eval DateStart="12/14/2016" | eval TimeEnd="1:38:27 PM" |eval TimeStart="1:38:27 PM"
| table DateStart TimeStart TimeEnd
| eval myfield=mvappend("DateStart=".DateStart,"TimeStart>".TimeStart, "TimeEnd<".TimeEnd)
| table myfield
| mvexpand myfield
| rename myfield as search
| format ( ( " " ) AND )
| rex field=search mode=sed "s/\( \"/( /g"
| rex field=search mode=sed "s/([=<>])/\1\"/g"
]
which gives this results for comparison
( ( DateStart="12/14/2016" AND TimeEnd="1:38:27 PM" AND TimeStart="1:38:27 PM" ) )
( ( DateStart="12/14/2016" ) AND ( TimeStart>"1:38:27 PM" ) AND ( TimeEnd<"1:38:27 PM" ) )
So those two results LOOK equivalent.
However, I'm leery of the date format, since you'd be comparing to a literal, and I don't think that's what you really want. Assuming your returned search values were in epoch time format, it turns out the code works the same --
| makeresults
| eval DateStart=strptime("12/14/2016","%m/%d/%Y")
| eval TimeEnd=strptime("12/14/2016 1:38:27 PM","%m/%d/%Y %l:%M:%S %p")
| eval TimeStart=strptime("12/14/2016 1:38:27 PM","%m/%d/%Y %l:%M:%S %p")
| table DateStart TimeStart TimeEnd
| format
| append
[| makeresults
| eval DateStart=strptime("12/14/2016","%m/%d/%Y")
| eval TimeEnd=(strptime("1:38:27 PM","%l:%M:%S %p")%86400 +DateStart)
| eval TimeStart=(strptime("1:38:27 PM","%l:%M:%S %p")%86400 +DateStart)
| table DateStart TimeStart TimeEnd
| eval myfield=mvappend("DateStart=".DateStart,"TimeStart>".TimeStart, "TimeEnd<".TimeEnd)
| table myfield
| mvexpand myfield
| rename myfield as search
| format ( ( " " ) AND )
| rex field=search mode=sed "s/\( \"/( /g"
| rex field=search mode=sed "s/([=<>]+)/\1\"/g"
]
produces this
( ( DateStart="1481673600.000000" AND TimeEnd="1481722707.000000"
AND TimeStart="1481722707.000000" ) )
( ( DateStart="1481673600.000000" ) AND ( TimeStart>"1481722707.000000" )
AND ( TimeEnd<"1481722707.000000" ) )
Made a slight update to the sed to make sure it would work for >= and <=
Updated to make sure the start and end time are relative to the date.