Hi guys, can someone tell me how to get all the lo...
# ask-community
a
Hi guys, can someone tell me how to get all the logs of a flow run if i give the flow run ID or better, when i am running the flow get it then only. I want to redirect it to a file. Kindly give a code snippet.
s
Something like:
Copy code
from prefect import get_client
from prefect.client.schemas.filters import (
    LogFilter,
    LogFilterFlowRunId,
)

async with get_client() as client:
    log_filter = LogFilter(flow_run_id=LogFilterFlowRunId(any_=[flow_run_id]))
    logs = await client.read_logs(log_filter)