push
Detects which alerts changed between your branch and main, then deploys only those to Elasticsearch.
Usage
orwell push [options]Options
| Flag | Alias | Default | Description |
|---|---|---|---|
--endpoint <url> | $ELASTIC_ENDPOINT | Elasticsearch URL | |
--api-key <key> | $ELASTIC_API_KEY | API key authentication | |
--username <user> | $ELASTIC_USERNAME | Basic auth username | |
--password <pass> | $ELASTIC_PASSWORD | Basic auth password | |
--target <server.env> | Filter: only deploy watchers matching this target | ||
--project-id <id> | -p | Prefix added to all alert IDs | |
--base-dir <dir> | src | Root folder that contains alert groups | |
--main-branch <branch> | main | Branch to diff against | |
--diff-branch <branch> | -b | current branch | Branch being compared |
--dry-run | Print HTTP requests without deploying |
How it works
- Runs
git diff <main-branch>...<diff-branch>to list changed files. - Finds the alert folder for each changed file.
- Filters alerts by
--targetif provided (see File naming & targeting). - Deploys each matching alert via the Elasticsearch Watcher API (
PUT /_watcher/watch/{id}). - If an alert has a Painless script, deploys it first via
PUT /_scripts/{id}.
Examples
Dry-run before deploying
orwell push \ --endpoint https://elastic:9200 \ --api-key $ELASTIC_API_KEY \ --target server-a.non-prod \ --dry-runDeploy to production
orwell push \ --endpoint https://elastic-prod:9200 \ --api-key $ELASTIC_API_KEY \ --target server-a.prodWith project ID prefix
orwell push \ --endpoint https://elastic:9200 \ --api-key $ELASTIC_API_KEY \ --project-id acme \ --target server-a.non-prodAlert IDs become acme-{group}-{name}.
Compare a specific branch
orwell push \ --endpoint https://elastic:9200 \ --api-key $ELASTIC_API_KEY \ --diff-branch feature/new-alerts \ --main-branch developUsing environment variables (recommended for CI)
export ELASTIC_ENDPOINT=https://elastic:9200export ELASTIC_API_KEY=your-key-here
orwell push --target server-a.non-prodNotes
pushnever deletes watchers. Usesyncif you also want to remove deleted alerts.- If
--targetis omitted, all changed alerts are deployed regardless of their filename target. --dry-runis safe to run in CI to validate that alert JSON compiles correctly before merging.