Elasticsearch API key is expiring within 30 days

Description

This alert is triggered when an Elasticsearch API key used by Environment Watch (EW) or Data Grid Audit (DGA) is within 30 days of its expiration date. Allowing the key to expire without renewal will cause a loss of connectivity to Elasticsearch, disrupting the Environment Watch monitoring pipeline or Data Grid Audit logging without warning.

Resolution Guidance

Impact When Active

  • Definite impact (if left unresolved before expiration): Once the API key expires, it loses authorization to communicate with Elasticsearch. Depending on which key expires, Environment Watch will stop collecting monitoring data or Data Grid Audit will stop logging audit events.
  • Possible/likely impact before expiration: No immediate service disruption occurs while the key is still valid, but the window to renew the key without downtime is shrinking. Delaying action risks expiration during off-hours when the disruption may go unnoticed longer.

How To Resolve

Use the Relativity Server CLI (relsvr.exe) to rotate the expiring key. The CLI creates a new key, invalidates the old one, and persists the new key to the Secret Store automatically - no manual Kibana configuration is required.

  1. Identify which key is expiring from the alert - it specifies whether the EW (rel-infrawatch) or DGA (rel-datagrid) key is affected.

  2. On the Relativity server, open PowerShell as Administrator and navigate to the Relativity Server CLI directory (e.g. C:\Users\relserviceaccount\Desktop\CLI\publish-cli).

  3. Run the appropriate rotation command:

    • For the Environment Watch (EW) key:

      Copy
      .\relsvr.exe rotate-api-key --cluster rel-cluster-infrawatch
    • For the Data Grid Audit (DGA) key:

      Copy
      .\relsvr.exe rotate-api-key --cluster rel-cluster-datagrid

    A successful rotation outputs:

    Copy
    API key rotation completed ---------------------------------------- 100%
    Successfully rotated the Elasticsearch API key and persisted the new key to the Secret Store.

    The only valid --cluster values are rel-cluster-infrawatch and rel-cluster-datagrid. Any other value will return an error.

  4. Verify the rotation succeeded by confirming the new key in the Secret Store:

    • EW key:
      Copy
      .\secretstore.exe secret read /database/elasticsearch/clusters/rel-cluster-infrawatch/security/api-keys/rel-infrawatch
    • DGA key:
      Copy
      .\secretstore.exe secret read /database/elasticsearch/clusters/rel-cluster-datagrid/security/api-keys/rel-datagrid

    The output should show a new api-key= value different from the one before rotation.

  5. Optionally confirm in Kibana (Stack Management > API Keys) that a freshly created rel-infrawatch or rel-datagrid key appears at the top of the list with a new expiration ~6 months out, and that the previous key no longer appears (it is automatically invalidated).

  6. Restart the relevant services to pick up the rotated key:

    • EW key (rel-infrawatch): Restart the Relativity Environment Watch service, then wait 2-5 minutes for the updated API key to be ingested.
    • DGA key (rel-datagrid): Restart the Relativity Environment Watch service and re-run all Kcura services to apply the new key.

If the rotation command fails or the alert does not clear, you can also try..

  • Run GET /_security/api_key?id=<old-key-id> in Kibana Dev Tools > Console and confirm "invalidated": true for the old key.
  • Run GET /_security/api_key?id=<new-key-id> and confirm "invalidated": false for the new key.
  • Confirm that the Relativity Server CLI version is current (.\relsvr.exe --version).
  • If the issue persists, contact Relativity Support.

Alert Details

Alert Condition Details

Name Value
Rule Type Metric threshold
Data View APM
Threshold < 30
Time Window 2 min
Frequency 1 min

Alert Metric Details

Metric Name: relsvr.elasticsearch_api_key

Metric Description: Alert will be true when any tracked Elasticsearch API key (EW, DGA, or alerts) has fewer than 30 days remaining until its expiration date. The alert thresholds on the Elasticsearch field numeric_labels.relsvr_elasticsearch_api_key_days_to_expire.

Metric Attributes:

Attribute Name Description
relsvr.elasticsearch_api_key.name Name of the API key
relsvr.elasticsearch_api_key.type Type of API key: ew (Environment Watch), dga (Data Grid Audit), or alerts
relsvr.elasticsearch_api_key.state Key health state: active, near_expiry, expired, or no_expiry
relsvr.elasticsearch_api_key.days_to_expire Number of days remaining until the API key expires
relsvr.elasticsearch_api_key.expiration_date_utc UTC expiration date of the API key
relsvr.elasticsearch_api_key.message Message describing the API key expiration status
Feedback