Skip to main content
The @grantex/destinations package includes a DatadogDestination that sends Grantex events to the Datadog Logs API. This guide covers setup, configuration, and example monitors for production alerting.

Prerequisites

  • A Datadog account with a Logs API key (not an application key)
  • The @grantex/destinations package installed:

Setup

Configuration Options

How It Works

The DatadogDestination buffers incoming events and flushes them in batches to the Datadog Logs HTTP API (POST https://http-intake.logs.<site>/api/v2/logs). Each Grantex event becomes a Datadog log entry with:

Filtering Event Types

To send only specific events to Datadog, filter at the EventSource level:

Datadog Log Pipeline

Create a Datadog log pipeline to parse Grantex events:
  1. Go to Logs > Configuration > Pipelines
  2. Create a new pipeline with filter source:grantex
  3. Add a JSON Mapper processor to extract fields from message:
    • event.type -> grantex.event_type
    • event.data.grantId -> grantex.grant_id
    • event.data.agentId -> grantex.agent_id
    • event.data.principalId -> grantex.principal_id
    • event.data.scopes -> grantex.scopes
  4. Add a Category Processor on grantex.event_type to set severity:
    • grant.revoked -> warn
    • budget.exhausted -> error
    • Everything else -> info

Example Monitors

High Grant Revocation Rate

Alert when grant revocations exceed a threshold, which may indicate a security incident or misconfigured agent.

Budget Exhaustion

Alert immediately when any budget is fully consumed.

No Events Received (Heartbeat)

Detect if the event stream connection drops.

Anomalous Token Issuance

Detect spikes in token issuance that deviate from the baseline.

Datadog Dashboard

Create a dashboard with these widgets for a Grantex overview:

Graceful Shutdown

Ensure buffered events are flushed before your process exits:

Next Steps

Last modified on March 1, 2026