kibana
kibana copied to clipboard
Synthetics Private locations do not properly handle spaces
I recently discovered that if you configure a browser based synthetic monitor with a private location and do not override the id of the monitor, and the monitor name contains spaces, it will break the fleet configuration with the following error:
failed to parse field [Check storefront homepage-otel-demo-monitors-default-55629068-e961-43c0-bf75-ad2e8c3d6d4f]\",\"caused_by\":{\"type\":\"validation_exception\",\"reason\":\"Validation Failed: 1: role name can only contain letters, digits and the characters '_', '-', and '.';\"}}},\"status\":400}"}
Full error below:
E1014 20:31:23.773039 7 leaderelection.go:436] error retrieving resource lock default/elastic-agent-cluster-leader: leases.coordination.k8s.io "elastic-agent-cluster-leader" is forbidden: User "system:serviceaccount:default:default" cannot get resource "leases" in API group "coordination.k8s.io" in the namespace "default"
{"log.level":"info","@timestamp":"2024-10-14T20:31:24.563Z","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/application/gateway/fleet.(*FleetGateway).Run","file.name":"fleet/fleet_gateway.go","file.line":138},"message":"Fleet gateway started","log":{"source":"elastic-agent"},"ecs.version":"1.6.0"}
{"log.level":"warn","@timestamp":"2024-10-14T20:31:26.192Z","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/application/gateway/fleet.(*FleetGateway).doExecute","file.name":"fleet/fleet_gateway.go","file.line":183},"message":"Possible transient error during checkin with fleet-server, retrying","log":{"source":"elastic-agent"},"error":{"message":"status code: 500, fleet-server returned an error: BadRequest, message: processPolicy: failed to prepare output \"default\": failed to prepare elasticsearch output \"default\": failed generate output API key: fail CreateAPIKey: [400 Bad Request] {\"error\":{\"root_cause\":[{\"type\":\"x_content_parse_exception\",\"reason\":\"[1:168] [role_descriptors] failed to parse field [Check storefront homepage-otel-demo-monitors-default-55629068-e961-43c0-bf75-ad2e8c3d6d4f]\"}],\"type\":\"x_content_parse_exception\",\"reason\":\"[1:168] [api_key_request] failed to parse field [role_descriptors]\",\"caused_by\":{\"type\":\"x_content_parse_exception\",\"reason\":\"[1:168] [role_descriptors] failed to parse field [Check storefront homepage-otel-demo-monitors-default-55629068-e961-43c0-bf75-ad2e8c3d6d4f]\",\"caused_by\":{\"type\":\"validation_exception\",\"reason\":\"Validation Failed: 1: role name can only contain letters, digits and the characters '_', '-', and '.';\"}}},\"status\":400}"},"request_duration_ns":945311708,"failed_checkins":1,"retry_after_ns":99437422765,"ecs.version":"1.6.0"}
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)
Adding some detail, if you have a journey named "Bad checkout" you get a policy with YAML like:
Bad Checkout-otel-demo-monitors-default-55629068-e961-43c0-bf75-ad2e8c3d6d4f:
indices:
- names:
- synthetics-browser-default
privileges:
- auto_configure
- create_doc
- read
- names:
- synthetics-browser.network-default
privileges:
- auto_configure
- create_doc
- read
- names:
- synthetics-browser.screenshot-default
privileges:
- auto_configure
- create_doc
- read
I'm thinking now that the real issue is maybe just missed quoting in the YAML.
Closing it since i am unable to reproduce.