How to Create a Scheduled Event-Based Job
Jobs allow you to define automations in Resoto and can be triggered on a regular schedule after
collect_and_cleanup workflow steps fire events.
This guide assumes that you have already installed Resoto.
Define the action you would like to automate. For example, let's say we want to clean up development accounts at the end of each week:
> search is(instance) in ["dev", "playground"] | cleantip
See Search How-To Guides for guidance on how to write search queries.
Determine the job schedule and define it using a cron expression. For example, if we want to run the job every Friday at 10pm:
0 22 * * FRI
Determine the event trigger for the job. In this case, since we want to send an alert as soon as a publicly accessible database is detected, we'll use the
cleanup_planevent to trigger the job.
Now that we've defined the action and decided on the trigger, create the job using the
jobs addcommand (replace the value of the
--idparameter with a unique job identifier):
> jobs add --id weekly_dev_cleanup --schedule "0 22 * * FRI" --wait-for-event cleanup_plan 'search ... | clean'