Skip to main content
Applies to:
  • Plan -
  • Deployment -
Organization-level retention shipped in data plane v2.9.0. On v2.9.0 or later, Enterprise plans can set a single organization-level retention policy instead of this per-project workaround. On earlier versions, use the steps in this article.

Summary

Goal: Enforce a 30-day log retention policy across all projects in an organization. Features: Project automation API, project listing API, retention policy management functions.

Configuration steps

Step 1: Understand scope

This workaround applies a retention policy to each project individually. New projects created after running this script need the policy applied separately.

Step 2: Set up the script

Save this script with your API key:

Step 3: Apply retention policy to all projects

Uncomment and modify the example usage at the bottom of the script to apply 30-day retention across all projects:

Step 4: Verify configuration

Check a specific project’s policy:

Notes

  • Retention storage charges on Pro and Enterprise plans are measured at ingestion, so applying this script doesn’t reduce them. Use it to keep less data for compliance or hygiene, not to lower retention storage costs.
  • Existing data older than the 30-day retention period is permanently deleted once a policy is applied.
  • The script checks for existing policies and updates them instead of creating duplicates.
  • Re-run the script for new projects created after initial setup.
  • Retention automations run on a system schedule — no separate cron step is required.

References