Loki log retention for PCI DSS Requirement 10

Loki can hold audit logs for the 12-month PCI DSS 10.5.1 window with recent data queryable, but retention, tiering and tamper protection are your configuration and evidence to prove.

On this page

How Loki helps meet PCI DSS log retention under Requirement 10.5.1

Self-hosted Loki can hold the 12-month history and the three months of immediately available logs that PCI DSS Requirement 10.5.1 expects, but the retention mechanics are only part of the answer. Loki keeps data indefinitely until retention is switched on, because the compactor applies retention and it is disabled by default. Once retention_enabled is set, you can define retention globally, per tenant, or per stream selector, with each stream rule at least 24 hours. That lets audit log streams from in-scope systems carry a longer period than general application logs. Object storage holds the compressed chunks and index, so your lifecycle and tiering rules in the bucket provider become part of the design. Confirm with your assessor how they will sample the history and whether the three-month window must be queryable without restoring archived data.

The PCI SSC does not certify or enforce compliance. Payment brands decide who must validate, and a QSA (for a Report on Compliance) or your own assessment (for a Self-Assessment Questionnaire) decides whether your evidence meets the requirement. Plan around PCI DSS v4.0.1, the only active version since v4.0 was retired on 31 December 2024, and document the result on the official template with an Attestation of Compliance. Requirement 10 also depends on things Loki does not provide: confirming that every in-scope system actually sends audit logs, synchronized clocks across those sources, access controls that limit who can read or delete logs, and integrity controls that detect changes. Loki has no built-in authentication, so an authenticating reverse proxy and tenant separation via X-Scope-OrgID must be designed and evidenced as part of the same control set.

Mapping PCI DSS 10.5.1 to Loki capabilities and configuration

This table maps the two halves of Requirement 10.5.1, twelve-month retention and three months of immediate availability, to the Loki settings and storage behavior that deliver them. Rows marked as environment-dependent or assessor-dependent need confirmation from your own systems and your QSA before you rely on them. The main takeaway is that Loki can enforce the retention period, but the scope of in-scope streams and the definition of immediately available data are decisions you document and defend.

Requirement elementLoki mechanismWhat to confirm
Twelve-month minimum retentionCompactor with retention_enabled set to true and a retention period of at least 12 months applied globally or per tenantRetention is disabled by default, so logs are kept indefinitely until enabled. Confirm the period in your written policy matches the 12-month minimum.
Per-stream retention for in-scope systemsPer-stream retention rules using stream selectors, each rule at least 24 hoursConfirm which streams carry in-scope audit logs. Environment-dependent: label naming and selector accuracy vary by cluster.
Three months immediately availableRecent data served from the ingesters and the most recent index and chunks in object storage, queried through Grafana or LogQLEnvironment-dependent: query latency for the last three months depends on your sizing and caches. Confirm with a timed test on your own data.
Object storage layout and tieringCompressed chunks and index in object storage such as S3, Google Cloud Storage or Azure Blob Storage, with lifecycle rules for older objectsLifecycle rules must not delete data before Loki retention runs. Confirm the approach against your object store and recovery design.
Protecting logs from tamperingRestricted write and delete permissions on the bucket, tenant isolation via X-Scope-OrgID, and an authenticating reverse proxy in front of LokiLoki has no built-in authentication layer. Assessor-dependent: the evidence needed for immutability should be agreed with your QSA.
Interpretation of 'immediately available'Loki query path for the last three months, documented as the analysis windowAssessor-dependent: confirm with your QSA what response time and access method they accept as immediate.
Scope of the cardholder data environmentLoki tenants and streams limited to systems that store, process or transmit cardholder data or could affect that environmentAssessor-dependent: the scoping decision belongs to you and your assessor, and it determines which streams need the 12-month rule.

Why Loki retention is off by default and how per-stream rules change scope

Loki keeps logs indefinitely until you turn retention on. Retention is disabled by default, so a fresh Loki deployment stores every stream it receives with no deletion at all. For PCI DSS Requirement 10.5.1 that default is safe in one direction only: nothing is removed too early. The risk is the opposite, because storage grows without any control and nobody has written down which logs must be kept for 12 months. Before you change anything, confirm in your own environment that retention_enabled is unset in the compactor configuration and record the current behavior as your baseline.

Retention is applied by the compactor, so the compactor is where the 12-month rule becomes real. You can set retention globally, per tenant, or per stream selector. Per-stream rules are the mechanism that matters for this topic: they let you give cardholder data environment (CDE) audit streams a 12-month period while other logs, such as debug output from development services, expire sooner. Each rule must cover at least 24 hours, so granularity is measured in days, not individual log lines. Plan your selectors from the label set you already use, and check that the selectors match the streams you intend and nothing else. Confirm the exact rule syntax and the per-tenant override behavior against the Loki retention documentation for the version you run.

Separating in-scope streams is a classification exercise before it is a configuration exercise. Inventory every source that could affect the security of the CDE, including authentication services, administrative consoles, firewalls, and the hosts that run payment components, and decide which of them produce audit logs that Requirement 10 covers. Give those sources a label that is applied consistently by the shipper, so a selector can target them reliably. If CDE logs share a tenant with non-CDE logs, a tenant-level rule cannot separate them, so decide early whether tenant boundaries or stream selectors carry the separation. Ask your qualified assessor to review the classification, because the scope decision is theirs to accept. Storage volumes depend on your log volume and cannot be estimated from this page, so measure your real ingest rate before sizing the bucket.

How logs move from ingestion to object storage with retention enforced

The flow starts with in-scope sources, where Grafana Alloy or another supported shipper collects logs and sends them through the authenticating reverse proxy into Loki's write path. Chunks and the TSDB index land in object storage, and the compactor applies retention rules per stream. Queries for the most recent three months go through the same proxy to the read path. Check that the proxy sits inside the trust boundary and that the X-Scope-OrgID tenant header is set on every request.

Log flow from in-scope systems to Loki storage, with retention and the query path.

Protecting Loki logs from tampering and unauthorized deletion

Requirement 10.5.1 only holds if the stored audit logs cannot be quietly altered or removed before the retention period ends. Loki enforces retention, but protection against tampering depends on the object store, the permissions around Loki's components and the access path in front of it. The cards below cover the controls to design and verify together.

Object storage immutability and versioning

Loki does not itself provide immutability for stored chunks or index files, so the protection must come from the object store. Confirm in your chosen store whether object versioning, write-once retention locks or legal holds are available, how they are configured on the bucket used by Loki, and whether they apply to deletes made by the compactor. Document the result as a store-level control with its own evidence, because the assessor will look for it outside Loki's configuration.

Loki storage docs

Bucket access policies

Grant the Loki write path, the querier and the compactor only the object permissions each one needs. Read-only roles should not carry delete rights, and no human account should hold broad delete access to the Loki bucket. Review the bucket policy as part of the Requirement 10 evidence, since an overly broad role can remove logs without touching Loki at all.

Separating compactor and delete rights

Retention deletion is performed by the compactor, and the delete API removes log data on request. Restrict both to a small set of operator identities, separate from the people who query logs. Keep the retention configuration under change control so that shortening retention for an in-scope stream is a reviewed, recorded change rather than a routine edit.

Tenant boundary with auth_enabled

With auth_enabled set to true, Loki separates data by the X-Scope-OrgID header sent on every request. Plan tenant IDs so that in-scope cardholder environment logs sit in their own tenant, and confirm that retention settings are applied per tenant. Note that the header is trusted only when the proxy in front of Loki sets it, so clients must not be able to choose their own tenant ID.

Multi-tenancy docs

Authenticating reverse proxy

Loki has no built-in authentication layer, so an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium must sit in front of it. Use it to enforce identity on every push and query, strip client-supplied tenant headers and log denied requests. Test the proxy directly, because a path that bypasses it leaves the store reachable without identity.

Authentication docs

Forwarding Loki's administrative activity

Changes to retention settings, tenant limits, delete requests and bucket policies are the events an assessor will ask about. Forward the logs of Loki components, the proxy and the object store's access logs to a separate destination that the Loki administrators cannot edit. Keeping these records outside the store they describe lets you show that a retention or deletion change was visible when it happened.

Configuring Loki retention for Requirement 10 in order

This sequence takes Loki from an agreed scope of in-scope log sources to a tested configuration that keeps audit logs for 12 months with the most recent three months queryable. Each step ends with a check the assessor or your team can review.

  1. Confirm in-scope systems and log sources

    Before any configuration, agree with your QSA or internal assessor which systems sit in the cardholder data environment and which of their logs count as audit logs under Requirement 10.5.1. Record each source, its log types and the owner who will answer questions. Ask the assessor to confirm whether any systems that could affect the security of the cardholder data environment belong in scope, since those are often missed. The output is a written source inventory that every later step maps to.

  2. Deploy Loki on a supported production object store

    Deploy Loki with its chunks and index in Amazon S3, Google Cloud Storage or Azure Blob Storage, the object stores Loki's documentation recommends for production. Your platform team chooses the deployment mode and sizing, and confirms that the chosen version is current on the Loki releases page. Local filesystem or S3-compatible stores such as MinIO are documented as not typically recommended for production, so treat them as a deliberate, documented exception if you use them. Done means the cluster starts, accepts test writes and stores objects in the bucket you intended.

  3. Enable retention in the compactor

    Retention in Loki is applied by the compactor and is disabled by default, so logs are kept indefinitely until you act. Set retention_enabled to true in the compactor configuration and confirm the compactor is running and has permission to delete objects in the bucket. Until this step is complete, no retention rule takes effect. Done means the compactor logs show retention is active and a test stream with a short rule is removed on schedule.

  4. Define per-stream retention for in-scope selectors

    Write retention rules that target the stream selectors from your source inventory, so in-scope audit logs carry the 12-month period while out-of-scope logs keep shorter or different periods. Loki supports rules per tenant or per stream selector, and each stream rule must be at least 24 hours. Use label selectors that the assessor can read directly, such as a scope label applied by Alloy at collection time. Done means every in-scope selector matches the expected streams in a query and no in-scope stream falls through to the default rule.

  5. Verify the three-month queryable window

    Requirement 10.5.1 requires the most recent three months of audit log history to be immediately available for analysis, which is a separate test from the 12-month total. Run queries against logs older than three months and confirm they return results from the bucket as expected, and confirm that data from the last three months is stored in a form your analysts can query without restoring from archive. Record the query times and the oldest timestamp returned. Done means a dated test report shows both the 12-month retention and the three-month availability.

  6. Configure access and tamper controls

    Protect the stored logs and the configuration that governs them. Place Loki behind an authenticating reverse proxy, since Loki has no built-in authentication layer, and limit who can change retention rules or delete objects in the bucket. Apply object store controls such as versioning, deny rules for deletion by non-compactor identities and separate credentials for the Loki writer, compactor and readers. Keep configuration under version control so changes leave a record. Confirm with your assessor which of these controls they expect to see as evidence. Done means a test user without rights cannot alter retention or remove objects, and each change is traceable.

  7. Test retention behavior before the assessment

    Run a dated retention test that writes synthetic log lines to a test stream, ages them past the configured period in a non-production copy, and confirms the compactor removes them while leaving in-scope data intact. Repeat the three-month query test on the production configuration. Record the results alongside the configuration, source inventory and access settings, and give the package to your QSA so they can plan their sampling. Done means the assessor has received the evidence and no open configuration questions remain.

Object storage tiering and lifecycle rules for 12-month retention

The simplest design keeps every retained chunk and index entry on one standard object storage tier and lets Loki's compactor enforce the 12-month period. Retention is disabled by default, so the team must set retention_enabled and define the period in the compactor configuration and any per-stream rules. Because nothing moves between classes, the 3-month immediately available requirement is met by the same store that holds the full year, with no restore step to slow analysts down. The trade-off is storage cost, since every day of the year is billed at the standard rate.

  • Retention enablement: Confirm retention_enabled is set on the compactor and that the period applies to the stream selectors that cover in-scope systems.
  • Cost modeling: Ask the provider for the storage and request pricing for a full year of your projected ingestion volume, then compare it with a tiered design.
  • Query behavior: Run queries across a date range older than three months to confirm response times meet your analysts' expectations.
  • Chunk and index review: Verify that compaction runs on schedule and that the index retains entries for the full period.
  • Provider durability: Confirm the replication and durability terms of your chosen store in writing.

Before relying on this design, check that the store's billing and durability terms match the year-long retention you plan to pay for.

Evidence to show an assessor for Loki retention

An assessor testing PCI DSS Requirement 10.5.1 will want proof that audit logs exist for 12 months and that the most recent three months can be queried right away. The items below connect the configuration, the storage layer, the query results, the tests and the people who can touch the log store, so each one supports the others.

Loki retention configuration export

Keep a versioned copy of the Loki configuration that shows retention_enabled set to true, the compactor settings, and the stream selector rules for each in-scope system. Retention is off by default, so an assessor will first check that this flag is set and that the period in each rule matches the 12-month requirement. Record the file's commit hash and deployment date so it can be matched to what was running during the audit window.

Minimum rule period
24 hours
Loki retention docs

Object storage lifecycle and access policy exports

Export the bucket lifecycle rules and bucket policy from the object store Loki writes to, whether S3, Google Cloud Storage or Azure Blob Storage. The assessor will check that transition rules keep recent data in fast storage for the three-month window and that deletion only happens after the full 12 months. Confirm which identities can change these policies, and export them on a schedule so changes are visible.

Loki storage docs

Three-month availability query records

Save dated query results that show logs from the most recent three months returning from the live Loki cluster, along with the LogQL queries used. Include at least one query against a month-old and one against a log older than three months, so the assessor can see that older data is still retained and can be retrieved. Confirm the expected response time with your own team, since this evidence shows the data is immediately available for analysis.

Retention and restore test records

Keep signed records of periodic tests that confirm retention is working as configured. Each test should show that data past the retention period is removed by the compactor, that data inside it is still queryable, and that an object restored from a lifecycle transition or backup can be read by Loki. Store the test date, the person who ran it, the expected result and the actual result.

Log store access review records

Maintain dated access reviews covering everyone and every service account that can read, write or delete in the Loki tenants that hold cardholder-environment logs, plus administrative access to the object store and the compactor. Assessors commonly sample these reviews to confirm that removed staff lost access and that deletion rights are limited. Pair each review with the identity provider export it was based on, and note any exception and its approval.

Questions buyers ask about Loki and PCI DSS retention

Does self-hosted Loki alone satisfy PCI DSS Requirement 10.5.1?

No. Loki can hold the audit log history and keep the most recent three months available for analysis, but Requirement 10.5.1 is a control outcome that depends on which systems send logs, how those logs are protected, and how the assessor tests them. Loki covers the storage and retention part. You still need to define which systems are in scope, confirm that the logs they produce reach Loki complete and with correct timestamps, restrict who can change or delete data, and document the whole arrangement for your assessor. Treat Loki as one component of the evidence, not as the compliance answer.

How much effort does a Loki retention setup for PCI DSS take?

Effort depends mostly on the number of in-scope log sources, the number of distinct retention rules, and how your object storage and access controls are already set up. Most of the work is design and verification rather than installation: mapping each in-scope system to a stream, setting per-stream retention, configuring lifecycle tiering, and testing that old data is removed only when it should be. Costs have a one-time part (design, build, testing, documentation) and a recurring part (storage growth, upgrades, access reviews, and periodic evidence collection). Ask any partner for a quote built from a written scope that lists sources, environments and deliverables.

What does the client team need to provide for this work?

The client team needs to supply the inputs that only it can confirm. These usually include:

  • A current list of systems in the cardholder data environment and systems that could affect it
  • Access to the infrastructure where Loki, object storage and the reverse proxy will run
  • Identity provider details for Grafana and administrative access
  • The retention period your assessor and policy require, and who approves it
  • Named owners for log review, access approvals and change control

The team also needs to agree who will receive the configuration and evidence, and how changes will be tracked after handover.

Can our own platform team build and run this internally?

Often yes, if the team already runs Kubernetes or Linux services, manages object storage and understands PCI DSS assessment. Loki is open source, its retention is controlled by the compactor and must be explicitly enabled, and its documentation describes the storage, tenancy and authentication behavior you need to configure. The risks are less about installation and more about gaps: retention left disabled by default, a missing authenticating proxy (Loki has no built-in authentication layer), logs that bypass the expected pipeline, or deletion permissions granted too widely. Before deciding, check whether your team has the time to design, test and document these controls and to keep them current through upgrades.

How long does a PCI DSS retention deployment take?

No timeline is established for this work in the supplied information, so confirm duration with any partner against a written scope. Duration depends on the number of in-scope sources, whether Loki is new or already running, the storage platform you use, and how long your change approval and assessor review cycles take. Ask for a plan that separates design, build, verification on a non-production environment, cutover, and evidence capture, and ask which of those steps depend on your team's availability.

Who decides whether our logging setup is compliant with PCI DSS?

The PCI Security Standards Council owns and maintains the standard, but it does not enforce compliance or impose penalties. The individual payment brands decide which entities must validate and run any enforcement programs. Your validation is documented on official PCI SSC templates, either a Report on Compliance completed by a Qualified Security Assessor or a Self-Assessment Questionnaire, each with an Attestation of Compliance. DeployOpen prepares systems, controls and evidence for compliance assessments but does not issue audit reports, attestations or certifications. Confirm with your acquirer or payment brands which validation path applies to you.

Which PCI DSS version should the Loki configuration be mapped to?

PCI DSS v4.0.1 is the only active version, since v4.0 was retired on 31 December 2024. Map your Loki controls against v4.0.1 and the requirement numbers it uses, not against older versions. The PCI SSC has also run a request for comments to start the next iteration, and as of October 2026 it had announced no release date for a new version. Confirm with your assessor which version and reporting template apply to your next assessment, and plan a review point when a new version is published.

How DeployOpen scopes and delivers Loki compliance configuration

DeployOpen starts by agreeing in writing which in-scope systems produce audit logs, which Loki tenants and streams hold them, and how retention is evidenced for PCI DSS Requirement 10.5.1. The configuration is then built inside your own infrastructure, tested against the retention and access settings, and handed over with documentation your assessor can review.

How we scope

  • Inventory the systems in your cardholder data environment that generate audit logs and confirm which ones your assessor treats as in scope.
  • Map each log source to a Loki tenant, stream selector and retention rule, with the reason each rule exists.
  • Agree the written scope, deliverables and timeline before work starts, with engagements typically fixed-scope and quoted from that scope.

How we build

  • Configure compactor retention with retention_enabled, per-tenant and per-stream rules, and object storage lifecycle rules matched to the 12-month and three-month requirement.
  • Put the authenticating reverse proxy, tenant header handling and Grafana access in front of Loki so only approved roles can read or change logs.
  • Test restores, query speed on the most recent three months, and that expired data is removed only after the defined period ends.

How we hand over

  • Deliver a retention matrix listing each log source, stream rule, storage tier, retention period and the owner responsible for it.
  • Document how log immutability, write-once or restricted delete permissions and admin audit trails are enforced, with the evidence each one produces.
  • Provide runbooks and a walkthrough so your team can show an assessor the configuration, settings and sample query results.

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after handover, covering Loki version changes and configuration drift.
  • Review retention rules again when the in-scope environment changes, such as new payment connectors or new log sources.
  • Confirm with your QSA or internal assessor which evidence they want and how your Attestation of Compliance will reference the logging controls.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.