Skip to main content

Observing your App

Whether your app is running as expected or not, there are various ways to find out what is wrong.

Logs

To view logs, you can either use Cockpit or nctl. Various components of Deploio can emit logs:

  • Build logs: these are logs produced by the build process. Useful if there's an issue with building your app.
  • App logs: these logs contain what the app replicas are outputting to stdout/stderr during runtime.
  • Worker Job logs: these logs contain what the worker job is outputting to stdout/stderr during runtime.
  • Deploy Job logs: these logs contain what the deploy job is outputting to stdout/stderr during runtime.

Examples

Display all logs of an app. These examples all use an app named go:

$ nctl logs app go
2024-10-22T16:07:55+02:00 {build="go-build-1", replica="go-build-1-build-pod"} Build successful
2024-10-22T16:07:59+02:00 {replica="go-59dcf7656f-9wr52"} 2024/10/22 14:07:59 starting HTTP server on :5678

The labels in between the curly braces tells you which component each log line belongs to. The labels can be turned off with the option --no-labels.

Display only the main app logs.

nctl logs app go --type app

Display worker job logs of an app.

nctl logs app go --type worker_job

Display deploy job logs of an app.

nctl logs app go --type deploy_job

Display all build logs of an app.

nctl logs app go --type build

Alternatively, you can also view the logs of a specific build using the logs build command.

nctl logs build go-build-1

You can add the -f flag to keep following the logs as they are emitted.

nctl logs app go -f

To get more lines, use the -l/--lines flag.

nctl logs app go-example -l 1000

To go further back in time, use the -s/--since flag. Durations can be specified using 1s (1 second), 1m (1 minute) and 1h (1 hour).

nctl logs app go-example -s 48h

Stats

To get an overview of the app replicas, their status and resource usage you can use the -o stats flag for the nctl get app command.

$ nctl get app rails -o stats
PROJECT NAME REPLICA STATUS CPU CPU% MEMORY MEMORY% RESTARTS LASTEXITCODE
nine-staging rails rails-9f6bdb676-crlrf ready 1m 0.8% 121MiB 47.4% 0 <none>
nine-staging rails rails-9f6bdb676-2pfps ready 1m 0.8% 123MiB 48.4% 0 <none>
nine-staging rails rails-9f6bdb676-sd9mm ready 1m 0.8% 122MiB 48.0% 1 137 (Out of memory)

If you have worker jobs defined, they will also show up here. The help output of nctl get app -h describes all the columns:

REPLICA: The name of the app replica.
STATUS: Current status of the replica.
CPU: Current CPU usage in millicores (1000m is a full CPU core).
CPU%: Current CPU usage relative to the app size. This can be over 100% as Deploio allows bursting.
MEMORY: Current Memory usage in MiB.
MEMORY%: Current Memory relative to the app size. This can be over 100% as Deploio allows bursting.
RESTARTS: The amount of times the replica has been restarted.
LASTEXITCODE: The exit code the last time the replica restarted. This can give an indication on why the replica is restarting.