Archiving LiteLLM request logs to object storage for audits
When an audit or incident review asks what a model was called with, by whom, and at what cost, the answer has to come from records that outlive the gateway database. LiteLLM's supported way to keep those records is a logging callback that writes request logs to a bucket. The gcs_bucket callback writes to Google Cloud Storage, and it requires an Enterprise license. Log export to GCS and Azure Blob is listed among the Enterprise features, so an organization that needs either destination should confirm the license covers it before the design is fixed. Writing to S3 and other destinations, such as AWS SQS and DynamoDB, is covered in LiteLLM's logging documentation, which lists the supported logging destinations and their configuration keys. Confirm the exact callback name and settings for an S3 target against the version you run, because the callback setup differs by destination.
The archive holds the per-request records the callback emits, which is the material an investigator needs to reconstruct a call: timestamps, the calling key or team identifiers, the model, token counts and cost. Whether it contains prompt and response bodies depends on how the gateway was configured, so confirm that before anyone relies on the archive for content questions. The archive does not replace the PostgreSQL database that backs virtual keys, budgets and spend tracking. Keys, budget changes and configuration edits are not recovered from a log bucket, so those need their own backup and change record. The archive is also a copy made at write time. If the callback failed for a period, the bucket has a gap, and the design should say how that gap would be detected and reported.
Plan three things before the first write. First, a dedicated service account or cloud identity for the gateway, with write permission to one bucket prefix and no read or delete permission for the gateway itself, so the proxy cannot quietly alter its own evidence. Second, bucket retention rules, such as object lock or a retention policy, set to the period your audit obligations require, with the legal owner of that period named in writing. Third, a restore test: pick a known request, find it in the bucket, and confirm the fields match the database record. Ask your cloud team how versioning and deletion protection are enabled for the bucket, and ask LiteLLM to confirm the callback behavior on the version you deploy.
What you need before enabling a bucket callback
A bucket callback only works when the gateway, its database, the cloud account and the network path are ready together. The cards below cover the pieces to settle before any callback is configured, in the order a platform team usually confirms them.
Self-hosted gateway and PostgreSQL
The proxy needs a supported, self-hosted deployment backed by PostgreSQL, which is the primary database LiteLLM names for production. Virtual keys, budgets and spend records depend on that database, so the archive is only as complete as the gateway that produces it. Confirm the exact release you run against the GitHub releases page, and check that it sits on a release line the vendor still supports before you rely on it for audit evidence.
Production guideLicense edition for GCS and Azure Blob
The gcs_bucket callback requires an Enterprise license, and log export to GCS and Azure Blob is listed among Enterprise features. An S3 destination is a different case, so confirm in the current logging documentation which callbacks each edition allows. Ask the vendor in writing which edition, term and support level covers your planned destinations before you design the pipeline around them.
Enterprise featuresCloud account and target bucket
Decide which account, region and bucket will hold the archive, and who owns that account for audit purposes. Plan the bucket before the callback so its name, region and encryption settings are fixed when log writes begin. Confirm with your security team where logs may be stored, since prompt metadata can carry sensitive content even when bodies are not stored.
Network path from proxy to bucket
The proxy must reach the storage endpoint from every pod or host that writes logs. In restricted or private networks, confirm whether traffic goes through a NAT gateway, a private endpoint or a service endpoint, and whether egress rules and DNS allow it. Test the path from the actual proxy runtime, not from a workstation, because firewall rules often differ between the two.
Service identity with least privilege
Create a dedicated service account, managed identity or IAM role for the proxy, and grant it write access to the archive prefix only. Keep its credentials out of configuration files and load them from your secret manager or workload identity. Give the identity no permission to delete or change retention on the bucket, so a compromised gateway cannot erase its own audit trail.
GCS bucket loggingConfirm release and terms with the vendor
Before rollout, check the exact LiteLLM release you run against the releases page and confirm current Enterprise terms, support scope and callback availability directly with the vendor. Documentation and feature availability change between releases, so record the version and the written terms in your change record alongside the test results.
- Latest listed release
- v1.105.1
How to configure the archive callback step by step
This sequence takes a self-hosted LiteLLM gateway from a confirmed Enterprise license to a verified, retained copy of request logs in object storage that matches the spend log.
Confirm edition and license before any build
Confirm with your LiteLLM account contact or procurement that your deployment holds an Enterprise license covering the GCS bucket or Azure Blob export you plan to use. The GCS bucket logging callback requires an Enterprise license, and log export to GCS and Azure Blob is listed among Enterprise features, so the open-source edition is not enough for those targets. Also confirm the running release is on a supported minor line. Done means you have a written confirmation of the license scope and a record of the running version from the proxy.
Create the bucket and folder layout
Create a dedicated bucket in the cloud account and region your data policy names, not a shared analytics or application bucket. Agree on a key prefix structure that separates environments and gateway instances, such as one prefix per environment, so investigators can scope a search by date and source. Turn on object versioning and server-side encryption with a key your security team controls, and block public access at the bucket level. Done means the bucket exists with these settings, and a manual test object written to the prefix is readable only by your administrators.
Create a dedicated write-only service identity
Create a separate service account, IAM role or managed identity used only by the gateway for log export. Grant it write permission to the target prefix and nothing else: no list of other buckets, no delete, no read of other data. Keep administrative and investigation access on separate identities. Decide who may read archived objects and grant that through a separate read role. Done means a test write with this identity succeeds, and a test delete or a write to another prefix is denied.
Store credentials in a secret manager
Place the service account key or workload identity configuration in your secret manager, not in the proxy configuration file or the container image. Reference the secret from the deployment so the gateway reads it at start-up, and keep the master key in its own secret. Restrict who can read the secret and record its rotation owner. Done means the running proxy process loads the credential from the secret store, and a search of the configuration repository and image layers finds no key material.
Enable the bucket logging callback in proxy configuration
Add the bucket logging callback to the proxy configuration file for your target, using the callback name and the bucket and prefix settings documented for that provider in the LiteLLM logging documentation. Keep the configuration in version control so changes to the callback are reviewed. Restart or roll the gateway following your deployment process, then check the proxy start-up log for an error that names the callback or the bucket. Done means the proxy starts cleanly with the callback listed as active.
Send test requests through known virtual keys
Send a small number of test requests through the gateway using a virtual key that belongs to a test team, with a known model and a recognizable prompt marker. Include one successful request and one request expected to fail, such as an unauthorized model, so you can confirm both outcomes are archived. Record each request ID returned to the caller. Done means the requests complete or fail as expected and you hold a list of request IDs for the next check.
Verify archived objects against the spend log
Wait for the export to run, then list the bucket prefix and open one archived object for a test request. Confirm the request ID, timestamp, model, key or team alias and token counts match the same request in the spend log. Confirm the failed request is present if your configuration archives failures. Check that prompt content appears or is absent exactly as your logging policy requires. Done means one object per test request reconciles to the spend log, and the field list is written into your runbook as the expected schema.
Which log fields land in the archive and who owns each
This table maps the main gateway log fields to how they appear in an archived record, who in your organization should own each one, and whether prompt storage changes it. Read it before you agree on the bucket schema, the retention rule and the access list, because fields marked as personal data or secret need exclusion or masking before they reach storage. Confirm the exact payload schema for your LiteLLM release, since field names and presence can change between versions.
| Field | Archived as | Owner and handling |
|---|---|---|
| Request ID and timestamps | Always present; one record per call with start and end times | Platform team owns; use for correlating with application logs and provider bills |
| Virtual key alias | Alias label only; confirm the raw key hash or token is never written | Security team owns; exclude any raw key or master key value from every callback |
| Team and user identifiers | Present when the request is attributed; may be an internal ID or an email address | Governance owner; an email address is personal data, so confirm whether to pseudonymize it |
| Model and provider name | Present for every call, including failed calls where the route was chosen | Platform team owns; needed for chargeback and incident timelines |
| Input and output token counts | Present for successful calls; confirm how failed calls report counts | FinOps or platform team owns; reconcile against provider invoices |
| Cost | Calculated from the configured price map; confirm the currency and rounding | FinOps owns; a stale price configuration can make archived cost differ from the bill |
| Prompt and response bodies | Present only if prompt storage is enabled for the team or gateway; otherwise absent | Privacy and legal owners decide; these bodies often contain personal data and need retention limits |
| Request metadata and tags | Custom metadata passed by callers is copied as sent | Application owners own; callers can place personal data or secrets here, so validate it before archive |
| Authorization headers and provider credentials | Must not be archived; confirm they are stripped before callbacks run | Security team owns; test with a canary key that the value never appears in a bucket object |
Choosing between GCS, Azure Blob and S3 destinations
The GCS option uses LiteLLM's gcs_bucket logging callback, which writes request logs to a Google Cloud Storage bucket. The LiteLLM GCS bucket documentation lists this callback as requiring an Enterprise license, so the destination is a licensing decision before it is an engineering one. The proxy authenticates to the bucket with a Google Cloud identity, most often a service account granted write access on the one bucket that receives logs.
- Identity model: A dedicated service account with object-create permissions on the log bucket only. Avoid reusing the proxy's runtime identity for other buckets.
- Licensing: Confirm with LiteLLM that the
gcs_bucketcallback is covered by the Enterprise license you intend to buy, and get that in writing with the quote. - Bucket controls: Set retention, object versioning and bucket lock settings in Cloud Storage itself, since the callback does not manage them.
- Audit trail: Logs land as objects in a bucket you own, so access to them is governed by Google Cloud IAM and audit logs, separate from LiteLLM's own audit logging.
- Regional choice: Pick the bucket location to match your data residency rules before the first write.
Confirm the callback configuration keys and the current Enterprise scope against the LiteLLM GCS bucket logging docs before you commit.
Azure Blob export is listed among LiteLLM's Enterprise features, so it sits under the same licensing condition as GCS. For organizations already standardized on Azure, the destination fits the existing identity and key management model. The identity choice is usually a managed identity for a proxy running in Azure, or a service principal when the proxy runs elsewhere. Confirm the exact authentication options against the current docs, because they determine how credentials reach the proxy.
- Identity model: A managed identity or service principal with the Storage Blob Data Contributor role scoped to the log container, not the whole storage account.
- Licensing: Verify with LiteLLM that Azure Blob export is included in your Enterprise terms, since the supplied listing names it as an Enterprise feature.
- Immutability: Use container-level immutability policies or legal holds if auditors need write-once records. These are configured in Azure, not in LiteLLM.
- Credentials location: If a secret or key is used instead of a managed identity, store it in your secret manager and rotate it on a schedule.
- Audit trail: Blob access logs and Azure Activity logs become the second layer of evidence for who read or changed archived records.
Ask LiteLLM which authentication methods the Azure Blob export supports in the version you plan to run.
The LiteLLM logging documentation lists S3 buckets as a logging destination alongside GCS, Azure Blob, AWS SQS and DynamoDB. For AWS-hosted gateways, S3 usually follows the IAM role model already used for the proxy's other AWS access. Because the supplied material places S3 in the general logging docs rather than in the Enterprise listing, confirm its licensing status separately rather than assuming it matches the GCS or Azure Blob terms.
- Identity model: An IAM role attached to the proxy's compute, such as an EKS service account role or an instance profile, with
s3:PutObjectlimited to the log prefix. - Licensing check: Ask LiteLLM to state in writing which license tier covers S3 logging in your target version.
- Retention: Use S3 Object Lock and lifecycle rules, which are set on the bucket, to meet your retention schedule.
- Cross-cloud consistency: If your SIEM or investigators work in another cloud, a bucket in another provider adds a second access path to review.
- Other destinations: SQS and DynamoDB serve different purposes from object storage, so decide whether they are archives or just event feeds before adopting them.
Before choosing, confirm the destination's licensing tier, identity method and retention behavior with LiteLLM and your cloud team.
Securing the archive: access, encryption and immutability
A log archive is only useful in an audit if people cannot quietly change or delete what it holds. The cards below cover the identity that writes logs, the people who read them, the keys that protect them and the bucket settings that make later edits visible or impossible.
Least-privilege write access for the proxy
The identity the LiteLLM proxy uses to write logs should be able to create objects under one prefix in one bucket and nothing else. Grant it no list, read, delete or bucket-policy permissions beyond what the callback needs, and confirm the exact action set against the current LiteLLM GCS bucket documentation before you finalize the policy. Test the policy by attempting a delete with the same credentials and expecting it to fail.
GCS bucket docsSeparate read access for investigators
Investigators and auditors need to read archived logs, but they rarely need to write or delete them. Give them a separate group or role with read-only access, and scope it to the bucket or prefix they need. Log each read through the cloud provider's audit logging so that access to prompt data is itself traceable.
Encryption at rest with customer-managed keys
Where your cloud offers customer-managed keys for object storage, use them so that you control key rotation and can revoke access by disabling the key. Confirm with your provider which key types each bucket class supports and whether the key policy can be restricted to the archive's service identity. Record who owns the key and who can change its policy, because those people can also make the archive unreadable.
Blocking public access
Enable the provider's public access block on the archive bucket and confirm it at the account or organization level, so a later change to a bucket policy or ACL cannot expose prompt data. Logs often contain user input, so treat any public read as a reportable incident. Check the setting in your provider's console or policy tooling as part of the deployment checklist.
Versioning and object lock as options
Object versioning keeps earlier copies when an object is overwritten or deleted, and object lock can prevent deletion for a fixed period. Both features vary by provider and bucket type, so confirm availability, cost and how they interact with your retention rules before choosing. If you use object lock, test whether the LiteLLM callback can still write new objects under your chosen mode.
Keeping the master key out of config files
The LITELLM_MASTER_KEY, which must start with sk-, and the storage credentials should live in a secret manager, not in config.yaml or environment files committed to source control. Inject them at runtime, rotate them on a schedule and restrict which workloads can read them. Confirm your secret manager integration path for your edition before wiring it into the callback settings.
How a request becomes an archived log object
The path starts at a client call to the LiteLLM proxy, which writes spend and request metadata to PostgreSQL and hands the same record to a logging callback. The callback writes the log object to the bucket under the proxy's cloud identity, which is the trust boundary: the proxy can write, while investigators read through a separate, audited role. Check that the write identity cannot read back or delete, and that the read path is limited to named investigators.
Request flow from client to archived log object and the read path.
Setting bucket retention without losing evidence
Retention is enforced by the bucket, not by LiteLLM. The gateway writes log objects and does not decide how long they survive. Lifecycle rules that delete or transition objects, retention locks that stop deletion before a set date, and legal holds that freeze specific objects are all configured in the cloud provider's storage service. Before go-live, the platform team should write down which of these controls is applied to the archive bucket, who can change them, and whether the same settings are reflected in infrastructure-as-code so they are reviewed like any other change. A lifecycle rule that expires objects after a short period can quietly erase the evidence an investigation needs, so the rule should be tested on a non-production bucket first.
Retention periods should come from the organization's own records policy, not from a default in a cloud console. The policy should state how long gateway logs must be kept for security investigations, for contractual commitments, and for each framework the organization is assessed against. Compliance and legal owners should sign off on the number and on whether any category of log needs a longer period or a hold. Where a framework requires evidence to be retained for a defined window, the bucket rule should match or exceed it, and the team should record the mapping so an auditor can trace a control to a setting.
Confirm each cloud's lifecycle, object lock and legal hold behavior in its own documentation before relying on it. Check how retention interacts with object versioning, whether a retention lock can be shortened or removed by an administrator, how the provider handles objects that are still under a hold when a lifecycle rule runs, and what a locked bucket means for later changes to the archive. Those answers differ between Amazon S3, Google Cloud Storage and Azure Blob Storage, so the team should test each behavior with a sample object and keep the results with the change record.
Why archive objects are missing or incomplete
This table lists the failures that most often leave a LiteLLM object storage archive empty, partial or stale, with the likely cause, how to confirm it and the fix for each. Work through the rows in order, since the license and callback checks rule out the most causes quickly.
| Failure | Likely cause and how to confirm | Fix |
|---|---|---|
| Callback writes nothing | The GCS bucket callback requires an Enterprise license. Without one, the callback does not run. Check the proxy startup log for license messages and confirm the license is loaded. | Install a valid Enterprise license key, restart the proxy and confirm the callback loads at startup. |
| Callback not loaded after config change | The callback is listed in the config file but the proxy was not restarted, or the YAML key is misspelled. Check the startup log for the callback name and compare the config against the logging docs. | Restart or redeploy the proxy after every config change, and fix the callback name so it matches the documented key. |
| Expired or wrong service account credentials | The service account key expired, was rotated without updating the secret, or belongs to a project that does not own the bucket. Check proxy logs for authentication errors and test the key with the cloud CLI from the proxy host. | Issue a new key or workload identity binding, store it in your secret manager, update the mounted secret and restart the proxy. |
| Bucket policy denies writes | The service account or role lacks object create permission, or a bucket policy, organization policy or condition blocks the write. Check the bucket audit logs for denied requests from the proxy identity. | Grant only the object write permission the callback needs on the target bucket or prefix, and review any deny conditions with the cloud security team. |
| Network egress blocked | The proxy runs in a restricted subnet with no route to the storage endpoint, or a proxy, firewall or private endpoint rule drops the traffic. Run a connectivity test from the proxy container to the bucket endpoint. | Open the required egress path to the storage endpoint, or configure a private endpoint and confirm DNS resolves to it. |
| Objects present but missing fields | Prompt and response content is not stored by default, so the archived records hold metadata only. Compare a sample object against the request in the UI or spend logs to see which fields are absent. | Decide whether bodies should be archived, enable prompt storage deliberately and document the choice with your privacy and security teams. |
| Gaps in time ranges | The proxy restarted or lost its database connection during the gap, or the bucket lifecycle rule removed older objects. Check the proxy restart history and the bucket lifecycle configuration. | Review restart and outage history, confirm lifecycle rules match your retention policy and alert on missing daily object counts. |
Questions buyers ask before archiving LiteLLM logs
Do I need an Enterprise license to archive LiteLLM logs to GCS or Azure Blob?
Yes. LiteLLM's gcs_bucket logging callback writes logs to a Google Cloud Storage bucket and requires an Enterprise license, and log export to GCS and Azure Blob is listed among the Enterprise features. S3 and Azure Blob destinations are also named among LiteLLM's logging destinations, so confirm with LiteLLM which bucket callbacks your chosen version and license tier allow before you design around them. The license is a separate line item from the infrastructure. Ask the vendor for the current Enterprise terms in writing, and ask DeployOpen to confirm the callback and license combination in the scope before work starts. The LiteLLM GCS bucket logging docs describe the callback configuration.
What drives the effort and duration of an object storage log archive?
The main drivers are the number of gateway instances and how logs leave them, the target cloud and whether it already has a bucket and key management pattern, the retention and legal hold rules your compliance team requires, and how many downstream tools read the archive. Effort rises when logs must be encrypted with customer-managed keys, when access must be split across several teams, or when the archive must be verified against an existing logging standard. A pilot in a non-production environment usually comes before production rollout. Ask any partner for a quote that lists each of these drivers separately, with the assumptions behind them, so you can compare it against your own team's time.
What access and approvals does the archive work need from our cloud and security teams?
The work needs a bucket or container in an account you control, a service account or workload identity with write permission to that bucket, and a way to store its credentials in your secret manager rather than in configuration files. Cloud teams will usually decide the bucket location, encryption keys, network path and naming. Security teams should review who can read the archive, whether object versioning and deletion protection are enabled, and how access is logged. Expect a short approval cycle for each item, and ask for these approvals early, because they often set the schedule more than the configuration itself.
Can our internal platform team set up log archiving without outside help?
Often yes, if the team already runs the gateway, manages cloud identities and has experience with object storage lifecycle rules. The configuration itself is small, but the work includes choosing what to archive, confirming the license, testing that records arrive intact, setting retention and deletion rules, and documenting the result for auditors. Teams without recent cloud identity or Enterprise licensing experience usually spend more time on those parts. A useful test is whether one engineer can restore a sample of archived logs and show an auditor where each record came from. If not, a fixed-scope engagement can cover the gap, and you can keep the runbook in your own hands.
How do archived LiteLLM logs support an audit without replacing the audit?
An archive gives you durable, time-bounded copies of gateway request records that you can show to auditors and use during investigations. It does not decide whether your controls are effective. Auditors still look at how the logs are generated, who can change them, how retention is enforced and whether records can be altered after they are written. Object versioning, write-once or retention locks where your cloud supports them, and separate access for the people who operate the gateway all strengthen the evidence. DeployOpen prepares systems, controls and evidence for compliance assessments, but independent auditors and certification bodies issue any audit opinion or certification.
What ongoing work recurs after the archive is live?
Recurring work includes reviewing bucket access and service account keys, checking that archive writes are succeeding, updating the gateway when LiteLLM releases change the callback, and applying retention and deletion rules as policies change. Upgrades need a test against the archive, since a new release can change log fields. Storage and egress cost grows with request volume and retention length, and you should ask a partner how it will help you watch those trends. Confirm the supported LiteLLM release line before scheduling upgrades, and ask for a quote that separates one-time setup from a retainer covering these recurring tasks.
Will archiving prompts and personal data into a bucket create extra compliance obligations?
Possibly. Request logs can contain personal data or confidential content if prompts and responses are stored, so the archive inherits the same privacy and security obligations as the source data. Decide first whether the archive holds metadata only or full bodies, because that choice changes the storage footprint and the review scope. Restrict access, set a retention period that matches your policy, and check the storage region against your data residency rules. Your privacy and legal teams should sign off before the archive receives full content.
How DeployOpen scopes and delivers the log archive
DeployOpen scopes archiving of LiteLLM request logs as a written, fixed-scope engagement covering the destination bucket, the logging callback, the service identity and retention rules. We build it inside your own cloud account or data center, then test and document it so your security and audit teams can review the archive directly.
How we scope
- Confirm which log fields, prompts and metadata must be archived and which must stay out of the bucket.
- Agree the target platform (S3, GCS or Azure Blob) and whether your license covers the chosen export path.
- Record retention periods, legal hold needs, encryption keys and the owner of each bucket in the written scope.
How we build
- Create the bucket, service account or IAM role with least-privilege write access, and configure the logging callback.
- Set bucket retention, versioning and lifecycle rules to match the retention periods agreed in the scope.
- Test that a sample of successful and failed calls lands in the bucket with the expected fields and timestamps.
How we hand over
- Deliver configuration files, IAM policy documentation and a runbook for rotating credentials and changing buckets.
- Provide evidence of retention settings, access controls and test results for your compliance reviewers.
- Walk your operations and security staff through restore and investigation steps before the engagement closes.
How we support
- Engagements are fixed-scope, so changes to buckets, retention or destinations are scoped and quoted separately in writing.
- Ongoing support, upgrades of the LiteLLM release and periodic retention checks are available as a retainer.
- Ask any provider, including us, to confirm how the archive will be reviewed when your audit cycle changes.

