Deleting an alert group with special characters in name

Hi everybody,

I have some alert groups defined on Loki in the past via cortextool --backend=loki with some special characters (like %) in their names… Not sure how cortextool allowed at the first place.

Now when I want to sync new set of alerts with cortextool rule sync --backend=loki ... (that supposed to delete some of those rules and add new ones) it cannot delete those with special characters due to escape issues "invalid URL escape \"%0x\"" and sync fails…

UI seems to delete but rule group is still there… When I want to edit alert rule group name, it cannot with "does not exist” error…

Any idea how can I delete these alert rules via API or other ways… I found following API call

DELETE /loki/api/v1/rules/{namespace}/{rule_group}

But when I execute that URL, I got “success” as output and no issues but still the alert group is there…

Any help is appreciated.

Thanks and kind regards
Suleyman Kutlu

When you do the DELETE api call, did you urlencode the special characters first?

You can also of course go with the nuclear option by removing all alert groups from your storage (assuming it’s something like S3) and re-create them. Proceed with extreme caution, of course…

Hi @tonyswumac

Yes, I have URLEncoded the alert group name and it returned success but not deleting the alert group at all.

In dev environment, I have nuked the namespace and that fixed it but I am searching for a better / more straight to the poing solution… Deleting from S3 is not an option for production environment, as we are using Grafana Cloud and we don’t have direct access :wink:

Thanks and kind regards
Suleyman Kutlu

Ah, ok. Have you tried contacting Grafana Cloud support and see if they can help you out?

Could not wait longer as it was effecting our alerting, and nuked the namespace via API calls in all environments and re-synced alert rules from source-code (without those special characters, obviously :slight_smile: ) …

Thanks a lot…