Answer:

Yes, you can use regexp to match the output (also called "HTTP message body", we receive up to 100MB output data from each execution of your cron job), and then judge if the cron job execution is successful.


Output regexp matching

As you can see in the above screenshot, there are 3 options you could choose from as the condition for your execution to be considered as succeeded or failed:

  • When the HTTP Status is 2xx, consider succeeded. (This is the default option)
  • When the HTTP Status is 2xx, consider succeeded if the HTTP message body matches a specified regular expression.
  • When the HTTP Status is 2xx, consider failed if the HTTP message body matches a specified regular expression.

After above 3 new options were added, the complete rules for judging success or failure are:

(1) When the HTTP Status is NOT 2xx (e.g. 404, 500, etc.), consider failed.
(2) When the HTTP Status is 2xx (e.g. 200, 201, etc.), the above 3 options applied.

For the sake of simplicity and matching performance, we use Google re2 as the regexp engine.