alerta/alerta

Create alert failed: Attribute keys must not contain "." or "$"

utsukprani opened this issue · 1 comments

Issue Summary
We are getting some information from external system which needs to be added to the attributes as keys. External system is sending keys which seem to have a dot (.) in them. When we try to create alert with such keys in the attributes, the alert creation fails and we see this message in the logs ...
Create alert failed: Attribute keys must not contain "." or "$"

Environment

  • OS: Linux

  • API version: 8.5

  • Deployment: Docker

  • Database: Postgres

  • Server config:
    { "actions": [], "alarm_model": { "colors": { "highlight": "skyblue", "severity": { "critical": "red", "normal": "green", "unknown": "lightblue", "warning": "orange" }, "text": "black" }, "defaults": { "normal_severity": "normal", "previous_severity": "unknown", "status": "open" }, "name": "Alerta 8.5.0", "severity": { "critical": 1, "normal": 3, "unknown": 4, "warning": 2 }, "status": { "ack": "C", "assign": "B", "blackout": "E", "closed": "F", "expired": "G", "open": "A", "shelved": "D", "unknown": "H" } }, "audio": { "new": null }, "auth_required": false, "aws_region": "us-east-1", "azure_tenant": "common", "client_id": null, "cognito_domain": null, "colors": { "highlight": "skyblue", "severity": { "critical": "red", "normal": "green", "unknown": "lightblue", "warning": "orange" }, "text": "black" }, "columns": [ "severity", "status", "lastReceiveTime", "timeoutLeft", "duplicateCount", "customer", "environment", "service", "resource", "event", "value", "text" ], "customer_views": false, "dates": { "longDate": "ddd D MMM, YYYY HH:mm:ss.SSS Z", "mediumDate": "ddd D MMM HH:mm", "shortTime": "HH:mm" }, "debug": false, "email_verification": false, "endpoint": "https://myserver:8080/api", "environments": [ "Production", "Development" ], "filter": { "status": [ "open", "ack" ] }, "font": { "font-family": "\"Sintony\", Arial, sans-serif", "font-size": "13px", "font-weight": 500 }, "github_url": "https://github.com", "gitlab_url": "https://gitlab.com", "indicators": { "queries": [ { "query": [ [ "environment", "Production" ] ], "text": "Production" }, { "query": [ [ "environment", "Development" ] ], "text": "Development" }, { "query": { "q": "event:Heartbeat" }, "text": "Heartbeats" }, { "query": "group=Misc", "text": "Misc." } ], "severity": [ "critical", "major", "minor", "warning", "indeterminate", "informational" ] }, "keycloak_realm": null, "keycloak_url": null, "oidc_auth_url": null, "provider": "basic", "refresh_interval": 5000, "severity": { "critical": 1, "normal": 3, "unknown": 4, "warning": 2 }, "signup_enabled": true, "site_logo_url": "", "sort_by": [ "severity", "lastReceiveTime" ], "timeouts": { "ack": 0, "alert": 31536000, "heartbeat": 7200, "shelve": 7200 }, "tracking_id": null }

  • web UI version: [eg. 6.8.1]

  • CLI version: [eg. 6.8.1]

To Reproduce
Steps to reproduce the behavior

  1. Create an alert and put some keys inside attributes where the key name has a dot (.).
  2. Alert creation will fail

Expected behavior
Alert should have been created successfully.

Screenshots
image

Additional context
N/A

NOTE: Please provide as much information about your issue as possible.
Failure to provide basic details about your specific environment make
it impossible to know if an issue has already been fixed, can delay a
response and may result in your issue being closed without a resolution.

This is a limitation of MongoDB. You can use a plugin to rewrite incoming alert attributes to only use accepted characters or drop those attributes.