Skip to main content
Applies to:
  • Plan -
  • Deployment -

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 limitations

Retention policies are scoped to individual projects. There is no org-wide setting. Each project requires its own retention automation. New projects created after running this script will 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