<@ULVA73B9P> is it possible to export the logs of ...
# ask-marvin
d
@Marvin is it possible to export the logs of a flow run as an artifact at the conclusion of it's execution?
m
Yes, it's possible to export the logs of a flow run as an artifact at the conclusion of its execution in both Prefect 2.x and 3.x. Prefect 2.x: Prefect allows logging to be integrated into flows using
get_run_logger
, which lets you record logs that can be stored and viewed in the Prefect UI. However, specific documentation on exporting these logs as artifacts directly wasn't readily available in the searches—this may require some custom handling to store logs in a desired format or location after execution. Prefect 3.x: Prefect 3.x supports creating run artifacts that are designed for human consumption and available in the UI. These artifacts can take various forms, like tables, images, or Markdown, and are a great way to record outputs or important run information. Artifacts are stored in Prefect Cloud or Prefect Server, allowing easy visualization and tracking over time. For more details, you can check the Prefect 3.x artifacts documentation. So, while Prefect naturally handles logging, arranging these logs into a structured artifact might take some custom coding around your flow's logic. Feel free to dive into Prefect's documentation for more insights: - Prefect 2.x Concepts on Artifacts - Prefect 3.x Artifacts Documentation Hope that helps! And remember, even the most advanced robots need a little log love now and then.