Filtering monitors

edit

When running the npx @elastic/synthetics push command, you can filter the monitors that are pushed to Kibana using the following flags:

--tags Array<string>
Push monitors with the given tags that match the glob pattern.
--match <string>
Push monitors with a name or tags that match the glob pattern.
--pattern <string>
RegExp pattern to match the journey files in the current working directory. Defaults to /*.journey.(ts|js)$/, for browser monitors and /.(yml|yaml)$/ for lightweight monitors.

You can combine these techniques and push the monitors to different Kibana clusters/space based on the tags by using multiple configuration files.

npx @elastic/synthetics push --config synthetics.qa.config.ts --tags env:qa
npx @elastic/synthetics push --config synthetics.prod.config.ts --tags env:prod

@elastic/synthetics locations

edit

List all available locations for running synthetics monitors.

npx @elastic/synthetics locations --url <kibana-host> --auth <api-key>

Run npx @elastic/synthetics locations with no flags to list all the available global locations managed by Elastic for running synthetics monitors.

To list both locations on Elastic’s global managed infrastructure and Private Locations, include:

--url <string>
The Kibana URL for the deployment from which to fetch all available public and Private Locations.
--auth <string>
API key used for Kibana authentication.

If an administrator has disabled Elastic managed locations for the role you are assigned and you do not include --url and --auth, all global locations managed by Elastic will be listed. However, you will not be able to push to these locations with your API key and will see an error: You don’t have permission to use Elastic managed global locations. For more details, refer to the troubleshooting docs.