<@ULVA73B9P> can i make prefect 3 in docker compos...
# ask-marvin
b
@Marvin can i make prefect 3 in docker compose only store logs in the db instead of in a mounted volume? i see them when i run docker logs --tail 100 -f prefect-worker
m
thought for 93.3 seconds
n
sorry i might be misunderstanding the question, but they are stored in the db https://github.com/prefecthq/prefect/blob/main/src/prefect/server/database/orm_models.py#L919-L939
m
Yes, you can configure Prefect 3.x to avoid writing logs to a mounted volume. Since you're already seeing the logs via
docker logs
, you can modify your configuration to only use console logging (which Docker captures) and the database. Here's how to do it: 1. In your docker-compose configuration, set these environment variables for your Prefect services:
Copy code
yaml
environment:
  PREFECT_LOGGING_LEVEL: "INFO"  # or your desired level
  PREFECT_LOGGING_HANDLERS_FILE_ENABLED: "false"  # disables file logging
2. If you have any volume mounts specifically for logs, you can remove them from your docker-compose.yml. This configuration will: - Store flow run logs in the Prefect database (which happens by default) - Output logs to stdout/stderr (which Docker captures) - Prevent creation of log files in the container The logs will still be: - Visible through
docker logs
as you're currently doing - Available in the Prefect UI - Stored in the Prefect database - Queryable through the Prefect API For more detailed logging customization options, you can refer to the logging customization documentation.
n
or i guess my question is, where/how are you seeing this?
writing logs to a mounted volume.
b
@Nate i’m seeing flow run logs in the docker compose logs as well, but that’s new, used to be just DB