LogDrop
Backend TracingRust

Other Hosts

Run a Rust service with LogDrop tracing on virtual machines, Docker and other platforms.

Outside Kubernetes you give the service its settings as environment variables. The service must add the LogDrop Rust crate; nothing else is installed on the host.

1. Put the ingest key in a file

The traces ingest key is the credential the crate sends traces to LogDrop with. Keep the key in a file that only the service's user can read, not in a variable on a command line:

sudo install -d -m 0750 -o root -g <service group> /etc/logdrop
printf '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
  printf '%s' "$LOGDROP_TRACE_KEY" | sudo install -m 0440 -o root -g <service group> /dev/stdin /etc/logdrop/trace-ingest-key
else
  echo 'That is not one traces key (it starts with ldtk_ and has 71 characters). Paste it once.'
fi
unset LOGDROP_TRACE_KEY

The crate re-reads the file every 10 seconds, so you can rotate the key without a restart.

2. Set the settings and start the service

The crate reads its settings from LOGDROP_* environment variables when the service starts. Set them wherever your service gets its environment: in the shell that starts it, in a systemd unit or in a container.

export LOGDROP_ENDPOINT=https://otel.logdrop.io
export LOGDROP_INGEST_KEY_FILE=/etc/logdrop/trace-ingest-key
export LOGDROP_SERVICE=orders
export LOGDROP_ENVIRONMENT=production
export LOGDROP_RELEASE=1.4.2            # optional
./orders

With systemd, put the same settings in the unit:

/etc/systemd/system/orders.service.d/logdrop.conf
[Service]
Environment=LOGDROP_ENDPOINT=https://otel.logdrop.io
Environment=LOGDROP_INGEST_KEY_FILE=/etc/logdrop/trace-ingest-key
Environment=LOGDROP_SERVICE=orders
Environment=LOGDROP_ENVIRONMENT=production

With Docker, mount the key file read-only and pass the settings:

docker run -d --name orders \
  -v /etc/logdrop/trace-ingest-key:/run/secrets/trace-ingest-key:ro \
  -e LOGDROP_ENDPOINT=https://otel.logdrop.io \
  -e LOGDROP_INGEST_KEY_FILE=/run/secrets/trace-ingest-key \
  -e LOGDROP_SERVICE=orders -e LOGDROP_ENVIRONMENT=production \
  <image>

Every setting is listed in Settings.

3. Check it

The service's standard error shows one line from the crate:

[logdrop-agent] INFO LogDrop Rust library 0.1.0-alpha1 is tracing service "orders" (environment "production") to otel.logdrop.io.

Send a request to the service. The trace appears in Trace Explorer within about a minute, and the service in Services within about two minutes.

Things to know

These points describe how the crate fits into your host's network and your service's processes. Check them before you run traced services in production.

  • The host needs outgoing HTTPS (port 443) to otel.logdrop.io. The crate does not use HTTP_PROXY or HTTPS_PROXY: it connects directly.
  • Outside Kubernetes each process gets a new instance ID when it starts. Set LOGDROP_SERVICE_INSTANCE_ID to keep one per host.
  • A batch job that exits right after its work should call logdrop::flush(Duration::from_secs(5)) before it returns, or rely on ShutdownGuard in main.

On this page