<@U04S8PLJWMT> How do I export logs from pods?
# ask-ai
j
@kapa.ai How do I export logs from pods?
k
To export logs from pods in an Airbyte Kubernetes deployment, you can use the following methods: ### 1. Using
kubectl logs
To view and export logs from a specific pod, run:
Copy code
kubectl logs -n <namespace> <pod-name>
You can redirect the output to a file to export the logs:
Copy code
kubectl logs -n <namespace> <pod-name> > pod-logs.txt
For example, if you are using a local development cluster with
abctl
, you might use:
Copy code
kubectl logs -n airbyte-abctl airbyte-abctl-server-74465db7fd-gk25q > server-logs.txt
[Developing Locally - Prerequisites](https://docs.airbyte.com/platform/1.7/contributing-to-airbyte/developing-locally#prerequisites) ### 2. Browsing and Copying Files from Pods If you need to export specific files (such as configuration or output files) from a pod, you can: - Exec into the pod:
Copy code
kubectl exec -it <pod-name> -n <namespace> -c main bash
Then use standard Linux commands to browse files. - Copy a file from the pod to your local machine:
Copy code
kubectl cp <namespace>/<pod-name>:/path/in/pod/filename ./local-filename
Example:
Copy code
kubectl cp jobs/normalization-worker-3605-0-sxtox:/config/destination_catalog.json ./catalog.json
[Browsing logs - Browsing on Kubernetes](https://docs.airbyte.com/platform/1.7/operator-guides/browsing-output-logs#browsing-on-kubernetes) These methods allow you to export logs and files from Airbyte pods running in Kubernetes.
j
@kapa.ai If the instance that is running Airbyte stops and starts again, can I retrieve the pod logs from before it stopping?
k
A message from kapa.ai
If the instance running Airbyte stops and then starts again, you generally cannot retrieve the pod logs from before it stopped if you are using the default Kubernetes logging setup. This is because pod logs are typically stored on the node's ephemeral storage, and when the pod is deleted or the node is stopped, those logs are lost. The knowledge sources confirm that once a pod is in the "Succeeded" state (i.e., completed and not running), you cannot exec into it to retrieve files or logs. The recommended approach to access files from a completed pod is to create a Kubernetes volume snapshot of the pod’s volumes and restore it to a new pod, then access the restored volumes. However, this only applies to data stored on persistent volumes, not to the standard pod logs, which are not persisted by default unless you have set up a log aggregation solution (like sending logs to S3, GCS, or a logging system such as DataDog, ELK, etc.) or have configured persistent storage for logs specifically. Otherwise, logs stored on ephemeral storage will be lost after a restart or pod deletion [Browsing-output-logs on Kubernetes](https://discuss.airbyte.io/t/4175). In summary: Unless you have configured persistent log storage or a log aggregation solution, you will not be able to retrieve pod logs after the instance stops and restarts.