
This assumes you have already
- Install Elastic Synthetics in NodeJS
- Create Elastic Synthetics Project using NodeJS
- Pushed a Journey using NodeJS
For example, let's say you have created a project named my-project. In your project directory there should be a directory named journeys.
]$ ls -l my-project/
drwxrwsr-x. 2 john.doe john.doe 4096 Jul 3 23:20 journeys
drwxrwsr-x. 2 john.doe john.doe 4096 Jul 3 23:20 lightweight
drwxrwsr-x. 130 john.doe john.doe 12288 Jul 3 23:20 node_modules
-rw-rw-r--. 1 john.doe john.doe 333 Jul 3 23:20 package.json
-rw-rw-r--. 1 john.doe john.doe 66656 Jul 3 23:20 package-lock.json
-rw-rw-r--. 1 john.doe john.doe 1323 Jul 3 23:20 README.md
-rw-rw-r--. 1 john.doe john.doe 813 Jul 3 23:20 synthetics.config.ts
And in the journeys directory there will probably one one or more journey.ts or journey.js files.
~]$ ls -l journeys/
-rw-rw-r--. 1 john.doe john.doe 1845 Jul 3 23:20 foo.journey.ts
-rw-rw-r--. 1 john.doe john.doe 1239 Jul 3 23:20 bar.journey.ts
And the Journeys should be in the ELK Synthetics Monitors UI.
Let's say you want to delete one or more journeys. You would delete the journey.ts or journey.js files for the journeys you want to delete.
rm my-project/journeys/foo.journey.ts
And then the npx @elastic/synthetics push command can be used to remove the journey from Elastic Synthetics.
npx @elastic/synthetics push --auth abc123
Of course, you can include the project ID, space, URL and locations options if you want to.
npx @elastic/synthetics push --url https://elk-example.com --auth abc123 --id my-project-id --space default --private-locations my-private-location
Something like this should be returned. Notice Removed(1) and a prompt asking you if you want to remove the journey.
> Pushing monitors for 'my_project' project in kibana 'default' space
> bundling 1 monitors
> Monitor Diff: Added(0) Updated(0) Removed(1) Unchanged(1)
✔ Deleting 1 monitors. Do you want to continue? (y/N) · true
> deleting 1 monitors (2683ms)
✓ Pushed: https://abcdefg123456789abcdefg123456789.us-east-1.aws.elastic-cloud.com:443/app/synthetics/monitors
The --yes flag can be used to remove the journey without being prompted which is great for non-interactive automation.
npx @elastic/synthetics push --auth abc123 --yes
Did you find this article helpful?
If so, consider buying me a coffee over at