LogDrop
Backend TracingJava

Rotate the Ingest Key

Replace a traces ingest key without losing traces.

Rotating replaces the traces ingest key your agents use with a new one, for example before the old key expires. 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

  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 re-reads the file every 10 seconds.

    Outside Kubernetes, replace the key file in one step: write a new file next to it, then mv it over the old one. The agent reads it within 10 seconds. Services that pass the key in LOGDROP_INGEST_KEY need a restart.

  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 agent logs LogDrop rejected the ingest key. Allow at least 10 minutes.

  4. Revoke the old key.

Things to know

  • 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.
  • A running service can also switch keys in code with LogDrop.updateIngestCredential(String); see Custom spans.
  • Revoking a key cannot be undone.

On this page