Skip to content

eval:watch

Evaluates a .js watcher file in the DSL context and prints the compiled Elasticsearch watcher JSON. Useful for debugging and validating JS watchers before deploying.

Usage

Terminal window
orwell eval:watch <path> [options]

Arguments

ArgumentDescription
<path>Path to the watcher.*.js file

Options

FlagAliasDefaultDescription
--project-id <id>-pProject ID prefix used in script references

Example

Terminal window
orwell eval:watch src/payments/order-failure/watcher.non-prod.js --project-id acme

Output:

{
"trigger": {
"schedule": { "interval": "1h" }
},
"input": {
"chain": {
"inputs": [
{
"logs": {
"search": {
"request": {
"indices": ["app-logs-*"],
"body": { ... }
}
}
}
}
]
}
},
"condition": {
"compare": { "ctx.payload.logs.hits.total": { "gt": 0 } }
},
"actions": {
"notify_slack": {
"webhook": { ... }
}
}
}

Notes

  • The watcher file must live inside a valid folder structure ({group}/{alert-name}/) so Orwell can derive the alert ID for script references.
  • This command only evaluates the watcher file — it does not transpile Groovy scripts or contact Elasticsearch.
  • For JSON watchers, use a regular text editor or cat instead.