On this page, backfill means exporting logs that CoreWeave already stores, not ingesting logs into Loki.
Prerequisites
Complete the following before you export logs:- Install LogCLI version 2.8.0 or later. The examples on this page use the parallel-download flags, which are available in LogCLI 2.8.0 and later. On macOS, you can also install LogCLI with
brew install logcli. - Create a CoreWeave API access token. For read-only access to logs, principals typically need the Observability Viewer IAM role. Assign it to the principal associated with the token.
- Choose the endpoint that stores your logs. For application, platform, and CKS audit log endpoints, see Logs data locations.
- Choose a start time and end time in RFC 3339 format, such as
2026-07-16T00:00:00Z. The start time must be earlier than the end time.
Configure LogCLI
SetLOKI_BEARER_TOKEN, which LogCLI uses to authenticate, and LOG_EXPORT_DIR, which the examples use to construct each part-file path. Replace [API-ACCESS-TOKEN] with your CoreWeave API access token secret. Replace [OUTPUT-DIRECTORY] with the directory where you want LogCLI to save the downloaded part files.
LOKI_ADDR to a Super Regional endpoint. To query another location or log type, select the corresponding endpoint from Logs data locations.
Export CKS audit logs
The following example downloads CKS audit logs for RegionUS-EAST-04 from the dedicated US East audit logs endpoint. Replace [START-TIME] and [END-TIME] with the RFC 3339 boundaries of the time range you want to export.
- Splits the requested time range into one-minute jobs.
- Runs up to four download workers concurrently.
- Scans each job forward from older to newer entries.
- Writes each completed job to a separate part file under the specified prefix.
- Writes each audit event as the raw JSON that Loki stores.
Choose an output format
LogCLI applies--output to the part files it writes, so the format you choose is the format you archive. The default output prefixes each line with its labels and timestamp, which isn’t machine readable without further processing.
The following table describes the values that --output accepts:
When you run LogCLI in a terminal,
--output=default also writes color codes into the part files. To suppress them, redirect LogCLI’s output or set the NO_COLOR environment variable.raw and jsonl based on whether the log line already carries its own timestamp and identifying fields:
- Use
--output=rawfor audit logs. Each audit event is already JSON and records its own timestamps and request details, so--output=jsonlwould nest that JSON inside another JSON object. - Use
--output=jsonlfor application and container logs. These lines are opaque text with no reliable embedded timestamp. The JSON wrapper therefore preserves when each line was written and which pod it came from.
--output=raw discards the Loki stream labels, and an audit event doesn’t repeat them in its body. The exported events therefore don’t record which Region, cluster, or pod they came from. Use --output=jsonl when you need to keep that context, or give each export a --part-path-prefix that identifies the source.
Export application logs for a container
The following example downloads logs from a specific container in RegionUS-EAST-04. Replace [CONTAINER-NAME], [START-TIME], and [END-TIME] with your container name and time range.
Container names aren’t unique across the Region, so this selector matches every container with that name in any cluster or namespace. To export logs from one workload, add cluster and namespace to the selector.
--output=jsonl rather than --output=raw so that each line keeps its labels and timestamp. If your workload already writes structured JSON logs that carry their own timestamp, use --output=raw instead to avoid nesting that JSON inside another JSON object.
Resume an interrupted export
LogCLI skips a time range when it finds the completed part file for that range. If an export stops before it finishes, rerun the same command to download only the missing parts.Handle query series limits
A broad audit log query can exceed the limit on the number of unique series a single query may return, which fails the query with an HTTP 400 response. If that happens, divide the query into separate queries by pod. To list pod names, run the following LogCLI command. It reads the label index instead of scanning logs, so it’s faster than a log query and doesn’t risk the same series limit:pod value on the endpoint for that time range. logcli labels doesn’t accept a stream selector, so the list isn’t restricted to a single Region. For more information, see the LogCLI labels command reference.
To list only the pods that produced matching audit logs, run this LogQL metric query in Grafana Explore instead:
pod label to the audit log selector. Replace [POD-NAME] with one of the pod names returned by the preceding query. Use a unique --part-path-prefix for that pod. Run the audit log export once for each pod. The following example sets LOKI_ADDR again, but still requires the LOKI_BEARER_TOKEN you set in Configure LogCLI:
See also
- Retention limits: how long CoreWeave keeps each telemetry type, which determines what you can still export.
- Configure Telemetry Relay: how to forward telemetry to an external destination when you need retention beyond those limits.
- Logs data locations: the full endpoint matrix for application, platform, and CKS audit logs.