LogDrop
Backend TracingPHP

Rotate the Ingest Key

Replace a traces ingest key without losing traces.

Rotate by running two keys side by side for a few minutes: create a second key, roll it out, wait until nothing uses the old key, then revoke it.

Do not use Rotate for a planned rotation

The panel's Rotate action issues a replacement and revokes the current key in the same step. Every agent that still holds the old key is refused until it reads the new one (about a minute on Kubernetes), and the traces of that minute are lost. Keep Rotate for a key that leaked, where stopping the old key at once matters more.

Steps

Rotating replaces the traces ingest key your agents use with a new one, for example before the old key expires. Follow these steps for a planned rotation:

  1. Create a second traces key in the panel (Services & APM → Credentials → Create credential).

  2. Put the new key everywhere the old one is. On Kubernetes, update the Secret in every traced namespace:

    printf 'New traces key (paste it once, then press Enter): ' && read -rs LOGDROP_TRACE_KEY && echo
    if [[ $LOGDROP_TRACE_KEY == ldtk_* && ${#LOGDROP_TRACE_KEY} -eq 71 ]]; then
      for ns in <namespace> <namespace>; do
        kubectl -n "$ns" create secret generic logdrop-trace-ingest-key \
          --from-literal=trace-ingest-key="$LOGDROP_TRACE_KEY" --dry-run=client -o yaml | kubectl apply -f -
      done
    else
      echo 'That is not one traces key (it starts with ldtk_ and has 71 characters). Paste it once.'
    fi
    unset LOGDROP_TRACE_KEY

    Running pods pick the new key up without a restart: the kubelet refreshes the mounted Secret within about a minute, and the agent reads the file again for every request (a long-running CLI worker every 10 seconds).

  3. Wait until the new key is in use everywhere: the panel shows its Last used time (updated at most every 5 minutes), and no service logs server returned with code 401. Allow at least 10 minutes.

  4. Revoke the old key.

Things to know

These points describe how agents react when a key changes or is revoked.

  • An agent whose key is refused reads the key file again before its next request, so after a revoke it recovers as soon as its file holds a valid key.
  • If you mount the Secret yourself instead of through the injector, do not use subPath: a subPath mount never sees Secret updates.
  • Revoking a key cannot be undone.

On this page