GitHub user dosubot[bot] added a comment to the discussion: Superset DB Log 
Retention & Pruning Strategies

<!-- Answer -->
Superset does not have built-in automated log retention or deletion for its 
metadata database logs. The recommended approach is to use the LogPruneCommand, 
which lets you delete records from the logs table older than a specified number 
of days. You can run this manually or automate it using an external scheduler 
like cron or Celery beat. For example, you can configure the prune_logs task in 
Celery to run at regular intervals for automated cleanup 
[reference](https://github.com/apache/superset/issues/33283).

Before pruning, consider backing up your logs if you need them for auditing or 
analysis. Deleting logs can impact audit trails and compliance, especially 
since log entries are linked to user actions and may block user deletion if 
associated logs exist 
[reference](https://github.com/apache/superset/discussions/34648). There are no 
code-based safeguards or soft deletes, so coordinate with your DBA and document 
your retention policy.

For large environments, adding indexes (such as on the dttm column) can improve 
pruning performance 
[reference](https://github.com/apache/superset/issues/16528). Manual SQL 
deletion is also possible: for example, `DELETE FROM logs WHERE dttm < 
'YYYY-MM-DD'` [reference](https://github.com/apache/superset/discussions/23110).

Best practices: automate pruning, back up before deleting, document your 
policy, and consider compliance/audit needs.


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/0f560775-fb12-43a5-b453-52790a837c57?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/0f560775-fb12-43a5-b453-52790a837c57?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/0f560775-fb12-43a5-b453-52790a837c57?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/0f560775-fb12-43a5-b453-52790a837c57?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/0f560775-fb12-43a5-b453-52790a837c57?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/0f560775-fb12-43a5-b453-52790a837c57?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/0f560775-fb12-43a5-b453-52790a837c57?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&
 nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/35811)

GitHub link: 
https://github.com/apache/superset/discussions/35811#discussioncomment-14757522

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to