<@ULVA73B9P> How to check if Prefect vacuum servic...
# ask-marvin
r
@Marvin How to check if Prefect vacuum service is running. Is there something specific in logs ?
m
thought for 86.2 seconds
If you're self-hosting Prefect Server, the main way to tell whether vacuum is running is: Check the server/background-services logs for messages starting with
Database vacuum:
. Examples of real log lines include:
Copy code
text
Database vacuum: deleted X orphaned logs.
Database vacuum: deleted Y orphaned artifacts.
Database vacuum: deleted Z old flow runs.
Database vacuum: deleted A old events and B event resources.
Database vacuum: deleted C 'prefect.flow-run.heartbeat' events and D event resources.
So yes — there is something specific in logs. Important detail: in Prefect 3.x, vacuum runs as a background service. In a scaled/self-hosted setup, that may be the process started with:
Copy code
bash
prefect server services start
not necessarily the API process itself. I’d check these things: 1. Is the vacuum service enabled? Check your config/environment for: -
PREFECT_SERVER_SERVICES_DB_VACUUM_ENABLED
-
PREFECT_SERVER_SERVICES_DB_VACUUM_LOOP_SECONDS
2. Are background services running? If you run API and services separately, make sure the services process is up. 3. Do logs show it being skipped? A sign it is not running is a log like:
Copy code
text
Skipping disabled perpetual service: schedule_vacuum_tasks
4. Do logs show periodic cleanup activity? By default, vacuum runs on a loop, so you should see
Database vacuum:
log lines periodically when there is work to do. A couple of nuances: - In Prefect 3.x, event vacuum is typically enabled by default. - Flow run cleanup vacuum may not be enabled by default, depending on config. - If you're using Prefect Cloud, this is managed for you and you generally won't have direct service logs for it. If you want, I can also give you: - the exact
prefect config view
keys to inspect, or - a Kubernetes/Docker-specific way to verify the vacuum/background services process is running.
r
@Marvin What if I have only standalone local prefect server without separated services.
m
thought for 14.4 seconds
If you're running a standalone local
prefect server start
without
--no-services
, then the vacuum service runs in that same server process. So in your case, the simplest answer is: Check the logs of the
prefect server start
process itself.
You do not need a separate services process unless you intentionally started the server with
--no-services
or are running a scaled deployment. What to look for: 1. Vacuum activity logs Look for lines like:
Copy code
text
Database vacuum: deleted ...
Examples:
Copy code
text
Database vacuum: deleted 100 old events and 100 event resources.
Database vacuum: deleted 15 orphaned logs.
Database vacuum: deleted 3 old flow runs.
2. Signs the service is disabled If vacuum is not enabled, you may see logs indicating a perpetual service was skipped. 3. No logs at all doesn't always mean it's broken Vacuum runs on an interval and may only log when it actually performs cleanup. So if your database is small/new, you might not immediately see much. A practical check list for your setup: - Start server normally:
Copy code
bash
prefect server start
- Watch the same terminal output for vacuum-related lines. - Confirm you did not use:
Copy code
bash
prefect server start --no-services
If you used
--no-services
, then vacuum will not run in that process. You can also inspect config to see if vacuum is enabled:
Copy code
bash
prefect config view
Look for DB vacuum settings, especially: -
PREFECT_SERVER_SERVICES_DB_VACUUM_ENABLED
-
PREFECT_SERVER_SERVICES_DB_VACUUM_LOOP_SECONDS
If you want, I can give you a small grep command to filter just the vacuum-related lines from local server logs.