Hi, I got a question about log retention in Prefec...
# ask-community
l
Hi, I got a question about log retention in Prefect Cloud (Starter and Standard) When it says only "1-2 weeks of run history", does that mean that the whole history is deleted? (UI, Interactive API) • Is there any way to keep logs other than the Enterprise plan? (For Prefect Cloud server, not custom made server) I've tried: • Custom logs in tasks/flows to storage. -> Not very useful or effective since involves work that is not necessary, since logs already exist in Prefect Cloud.
a
@Lucas Hosoya that’s correct. Currently, to get more than 2 weeks of history on a Standard plan, you would need to contact sales@prefect.io For example, this account is on a Standard plan and you can see that the oldest flow run displayed in the Dashboard is from exactly 2 weeks ago, even though I have this account for much longer:
l
Hey, thanks for the reply! I'll be looking with the team to solve this!
a
@Lucas Hosoya in theory, you could build your own solution somehow to either query logs from the API and store it somewhere else:
Copy code
query {
  flow_run {
    logs {
      flow_run_id
      id
      object_id
      object_table
      created
      info
      level
      message
      timestamp
      is_audit_log
      name
      task_run_id
    }
  }
}
But this would be probably cumbersome. The easiest way to approach this would be to backup logs on your execution layer. E.g. if you use a Kubernetes agent on AWS EKS, you could set up a mechanism to store all logs for all pods in CloudWatch.
👍 1
l
That would work too! Our plan is to throw all of the logs into a storage and analyze with ELK
👍 1
a
For instance, if you use ECSAgent, then all your logs from the ECSAgent and ECS tasks of the flow runs are by default persisted in CloudWatch so when there is an emergency and you need to find logs from flow runs from over 2 weeks ago, you would find them in CloudWatch
👍 1