Read logs and open a shell
When an app misbehaves, its logs and a shell inside its container are usually the fastest way to find out why. Use the console on the app’s Overview tab to follow what the app is doing now, read the output of a container that crashed, or run commands in a container. To search older logs, use Observe > Logs, described in Monitor an app.
Stream live logs
Section titled “Stream live logs”- Open the app.
- Go to Overview.
- In the console, select Logs.
- To follow one replica, open the source menu.
- Select a pod and container.
orchard logs <id> --followTo read build logs, add --build.
Read past logs
Section titled “Read past logs”Past logs include replicas that have since been replaced. They come from the instance’s log store. If the view is empty, refer to Configure logs and request data.
- Open the app.
- Go to Observe > Logs.
- Select a time range.
Read crash output
Section titled “Read crash output”Orchard captures the final output of a container that was killed, including out-of-memory (OOM) kills. It attaches the output to the app.
- Open the app.
- Go to Overview.
- In the console, open the source menu.
- Select the entry for the container labeled Output from before the last crash.
orchard deploy killed list <id>orchard deploy killed logs <id> <entry-id>Diagnose a crash loop
Section titled “Diagnose a crash loop”In a crash loop, a container starts and exits, and Kubernetes restarts it. Read the exit reason and the last logs.
| Symptom | Likely cause | What to do |
|---|---|---|
| Exits immediately with a module or import error | The image is missing a dependency, or the build used the wrong stage | Check the build stage |
| Exits after a few seconds with connection refused | The app cannot reach its database | Check the internal host and the credentials |
| Killed with exit code 137 | The container ran out of memory | Raise the memory limit or fix the leak |
| Runs but never becomes ready | The health check path or port is wrong | Check health checks |
Open a shell
Section titled “Open a shell”A shell opens a terminal inside a running container. It uses the same authentication as the dashboard.
- Open the app.
- Go to Overview.
- In the console, select Shell.
- If the app has more than one pod or container, select one.
The CLI runs one command at a time in a pod. It does not open an interactive shell.
orchard pod exec <pod> -- envTo open the app’s language REPL in a pod, run orchard console <id>.
Changes you make in a shell are lost on the next restart. A command that uses too much memory can cause Kubernetes to kill the container.
Database logs
Section titled “Database logs”A database has the same console on its Overview tab.
- Logs streams the logs of an instance.
- Killed lists containers killed in the last 24 hours, with their final output.
- Shell opens a terminal in an instance.
To open psql from the CLI, run orchard db psql <id>.
Kubernetes events
Section titled “Kubernetes events”Observe > Events lists crashes and Kubernetes warnings for the app’s pods, newest first. It includes failed scheduling, image pull problems, probe failures, and volume mounts. It also shows how many times each one repeated.
The alert banner above an app’s tabs shows only problems that exist now. Kubernetes keeps warning events for about an hour after a problem clears, so the history can show warnings the banner does not.
Related resources
Section titled “Related resources”- Metrics and alerts - Find where Orchard shows metrics, current problems, and alerts.
- Builds - Read build logs and fix a build that fails.
orchard logsreference - Everyorchard logsflag.