-
I have a self-hosted Prefect server v3 running with Postgresql DB. I'm curious how logging works.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
hi @Pballer
|
Beta Was this translation helpful? Give feedback.
-
For example in my company, we clean the logs on daily basis at night using the external job on Kubernetes: DELETE FROM log WHERE created < (CURRENT_DATE -14);
DELETE FROM flow_run WHERE created < (CURRENT_DATE -14);
DELETE FROM flow_run_state WHERE created < (CURRENT_DATE -14);
DELETE FROM task_run WHERE created < (CURRENT_DATE -14);
DELETE FROM task_run_state WHERE created < (CURRENT_DATE -14);
DELETE FROM events WHERE created < (CURRENT_DATE -14);
DELETE FROM event_resources WHERE created < (CURRENT_DATE -14);
DELETE FROM artifact WHERE created < (CURRENT_DATE -14); You also have to run VACUUM in order to restore the storage (for each table): VACUUM FULL log; (...) |
Beta Was this translation helpful? Give feedback.
hi @Pballer
with the open-source server, yes logs are stored in the database.
there is no automatic clean-up of old logs in the open source server, but you could implement a periodic job to clean up old logs
technically it would be possible, but not without changing how the prefect server works. you could just aggressively clear logs or avoid using the prefect logger in the first place