> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/cdf/4.2/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/cdf/4.2/configuration/archive.md).

# Archive CDRs

CDF allows you to store copies of CDRs in an archive service after they are sent to a CGF. Archiving CDRs may be useful for troubleshooting, for example, to check the contents of CDRs when investigating issues.
The component responsible for archiving CDRs is CDF sender.

This is a sample archive configuration for CDF sender:

```yaml
sender:
  CGFs:
  -
    IP: 192.0.2.1

nats_services:
  work_queue:
    url: nats://queue.example.com
    subject: CDR.arrived
    streamName: CDR
    consumerName: CDF
    poolSize: 8
  kv_store:
    url: nats://kv.example.com
    bucket: CDFbucket
    poolSize: 8
  archive:
    url: nats://archive.example.com
    subject: CDR.archived
    error_subject: CDR.error
    poolSize: 8
    compression: zlib
    encoding: JSON

resources:
  cdf:
    limits:
      cpu: 5000m
      memory: 1Gi
```

The archive service stores copies of CDRs after they are sent to CGFs.
Although the archive service has no size limit, you must ensure enough disk space is available to avoid storage problems. Each message stored in the archive should have a defined time-to-live (TTL), which controls how long the message remains available before it is automatically deleted.

When configuring the archive stream, you should:
- Apply a `limits` retention policy
- Set a TTL (for example, `x` days) according to legal or organisational requirements
- Enable compression to save storage space

For more information on how to configure streams, read the official [NATS stream](https://docs.nats.io/nats-concepts/jetstream/js_walkthrough) documentation.
