Hi All, I need to extract logs of a specific time ...
# suiteanalytics
s
Hi All, I need to extract logs of a specific time of yesterday. Hence wrote a saved search on "Server Script Logs" type, with date as 24th feb 2020. But im struggling to extract the logs only between 2:00pm to 3:00pm. How do i achieve this using "Formula (Date) {time}>2:00". I tried and ended up with an error : Your formula has an error in it. It could resolve to the wrong datatype, use an unknown function, or have a syntax error. Please go back, correct the formula, and re-submit. Search: Server Script Log Search Formula: {time} > 2:00 Please suggest the best way to extract logs between 2:00pm to 3:00pm
b
use a regular date filter
s
I had an option only to choose date , but not time. My search is written on "Server Script Logs" type.
@battk Under Formula(Date), there is an option to pick {time} field. But i dont know the right formula to use.
b
i think {time} is a timestamp, so create a numeric or text formula to check if {time} is between the 2 timestamps you want
Copy code
CASE
    WHEN {time} BETWEEN TO_TIMESTAMP( '2020-02-24 14:00:00.0' ,'YYYY-MM-DD HH24:MI:SS.FF' ) AND TO_TIMESTAMP( '2020-02-24 15:00:00.0' ,'YYYY-MM-DD HH24:MI:SS.FF' )
    THEN 1
    ELSE 0
END
s
Still facing the error: -
Your formula has an error in it. It could resolve to the wrong datatype, use an unknown function, or have a syntax error. Please go back, correct the formula, and re-submit. Search: Server Script Log Search Formula: CASE WHEN {time} BETWEEN TO_TIMESTAMP( '2020-02-24 140000.0' ,'YYYY-MM-DD HH24MISS.FF' ) AND TO_TIMESTAMP( '2020-02-24 150000.0' ,'YYYY-MM-DD HH24MISS.FF' ) THEN 1 ELSE 0END
b
you might want to make sure there is a space between 0 and end
otherwise make sure your formula uses the correct data type
the one i wrote is numeric, but it can work with any data type if you change the return expressions