View track logs
Look behind the curtains.
This guide explains how to view track logs from Instruqt CLI.
When learners play a track, actions like executing a challenge setup script or loading a Kubernetes module are logged. You view track logs from the Instruqt CLI:

Debugging

Track logs are helpful for debugging. They show the executed track steps when starting and playing tracks. Like in the following example:
==> Finding track by slug: instruqt/kubernetes
==> Tailing logs for track 'instruqt/kubernetes' (ID: 1w8pib6cdmfl)
2021-12-27T19:00:32Z yngfynrjymow INFO: Setting up environment
2021-12-27T19:00:33Z yngfynrjymow INFO: Running 'terraform init'; workdir: /tmp/yngfynrjymow
2021-12-27T19:00:34Z yngfynrjymow DEBUG: Initializing modules...
2021-12-27T19:00:34Z yngfynrjymow DEBUG: - core in core
2021-12-27T19:00:34Z yngfynrjymow DEBUG: - shell in container
2021-12-27T19:00:34Z yngfynrjymow DEBUG: - workstation in container
2021-12-27T19:00:34Z yngfynrjymow DEBUG:
2021-12-27T19:00:34Z yngfynrjymow DEBUG: Initializing the backend...
2021-12-27T19:00:34Z yngfynrjymow DEBUG:
2021-12-27T19:00:34Z yngfynrjymow DEBUG: Initializing provider plugins...
2021-12-27T19:00:34Z yngfynrjymow DEBUG:
2022-12-27T19:00:34Z yngfynrjymow DEBUG: module.core.kubernetes_namespace.participant: Creating...
2022-12-27T19:00:34Z yngfynrjymow DEBUG: module.core.kubernetes_namespace.participant: Creation complete after 0s [id=zmldx3bmkczf]
2021-12-27T19:00:34Z yngfynrjymow DEBUG:
2021-12-27T19:00:34Z yngfynrjymow DEBUG: Outputs:
2021-12-27T19:00:34Z yngfynrjymow DEBUG:
2021-12-27T19:00:34Z yngfynrjymow DEBUG: alicloud_accounts = []
2021-12-27T19:00:34Z yngfynrjymow DEBUG: aws_accounts = []
2021-12-27T19:00:34Z yngfynrjymow DEBUG: azure_subscriptions = []
2021-12-27T19:00:34Z yngfynrjymow DEBUG: gcp_projects = []
2021-12-27T19:02:02Z yngfynrjymow INFO: All scripts completed for action: setup
2021-12-27T19:02:02Z yngfynrjymow INFO: Executing action: setup for challenge: pjdxmwz493v7
2021-12-27T19:02:14Z yngfynrjymow INFO: Starting script: setup-container
2021-12-27T19:02:14Z yngfynrjymow INFO: setup-container: + echo the participant is nglaz9e9zqoz
2021-12-27T19:02:14Z yngfynrjymow INFO: setup-container: the participant is nglaz9e9zqoz
2021-12-27T19:02:14Z yngfynrjymow INFO: Finished running script: setup-container
2021-12-27T19:02:14Z yngfynrjymow INFO: All scripts completed for action: setup
2021-12-27T19:03:37Z yngfynrjymow INFO: Executing action: check for challenge: pjdxmwz493v7
2021-12-27T19:03:37Z yngfynrjymow INFO: Starting script: check-container
The track logs include output from the following track scripts:
  • Sandbox scripts:
    • setup
    • cleanup
  • Challenge scripts:
    • setup
    • check
    • cleanup
And you see two types of log entries:
  • INFO These entries contain details of the backend script execution. Like in lines 3 and 4, and lines 23 to 31 of the example.
  • DEBUG These entries contain details of the following:
    • Initializing the backend and plugins (lines 5 to 12)
    • Loading modules (lines 14 and 15)
    • Showing values of variables (lines 17 to 22)
Furthermore, note the participant-id yngfynrjymow that identifies the learner who plays the track.
Viewing track logs can only be done with Instruqt CLI. Install Instruqt CLI first if necessary.

Log view entities

You can view the logs of the following entities:
  • Local track
  • Remote track
  • Single play of a track

Local tracks

These are tracks whose configuration files are on your machine.

Remote tracks

These are tracks whose configuration files are not on your machine.

Single play of a track

A track can have many concurrent plays. And every play logs its own details. With requesting to view a single play of a track, you can limit the log entries to a specific track.

Since a certain time

Furthermore, you can view track logs starting from a given date and time.

Before you begin

You must have already built a track, of which you can view the log. Follow the guide Create a track from a template if needed.

Start viewing track logs of a local track

Follow these steps to view the log of a local track:
💻 Instruqt CLI
  1. 1.
    Activate your track directory:
    cd DIRECTORY_NAME
    ⇨ Replace DIRECTORY_NAME with your track directory.
  2. 2.
    Start logging the track:
    instruqt track logs
    ↳ After a few seconds you see logging entries like these:
    ==> Finding track by slug: instruqt/kubernetes
    ==> Tailing logs for track 'instruqt/kubernetes' (ID: 1w8pib6cdmfl)
    2021-12-27T19:00:32Z yngfynrjymow INFO: Setting up environment
    2021-12-27T19:00:33Z yngfynrjymow INFO: Running 'terraform init'; workdir: /tmp/yngfynrjymow
    2021-12-27T19:00:34Z yngfynrjymow DEBUG: Initializing modules...
    2021-12-27T19:00:34Z yngfynrjymow DEBUG: - core in core
    ↳ The command continues to tail the logs—thus showing new log entries—until you cancel the command with Control+C (or Command+C on Mac).
    Advance your debugging
    You can extend the track logs with your own log entries for debugging. You do this by adding echo commands in your lifecycle scripts. For example, you can log commands that do not output log entries themselves:
    echo Running command COMMAND_NAME ⇨ Replace COMMAND_NAMEwith your command.
    Start the script with the -x flag to show verbose log output:
    #!/bin/bash -x
    echo Running command COMMAND_NAME

Start viewing track logs of a remote track

You need to know the slug of the remote track. You can find the slug in the (Web UI) track details:
And then start the logging of the remote track:
💻 Instruqt CLI
instruqt track logs TRACK_SLUG
⇨ Replace TRACK_SLUG with your track slug.
↳ After a few seconds you see logging entries like these:
==> Finding track by slug: instruqt/kubernetes
==> Tailing logs for track 'instruqt/kubernetes' (ID: 1w8pib6cdmfl)
2021-12-27T19:00:32Z yngfynrjymow INFO: Setting up environment
2021-12-27T19:00:33Z yngfynrjymow INFO: Running 'terraform init'; workdir: /tmp/yngfynrjymow
2021-12-27T19:00:34Z yngfynrjymow DEBUG: Initializing modules...
2021-12-27T19:00:34Z yngfynrjymow DEBUG: - core in core
↳ The command continues to tail the logs—thus showing new log entries—until you cancel the command with Control+C (or Command+C on Mac).

Start viewing track logs of a single play

A track can be played by many concurrent learners. And each learner has their own participant-id as in the following track logs:
==> Finding track by slug: instruqt/kubernetes
==> Tailing logs for track 'instruqt/kubernetes' (ID: 1w8pib6cdmfl)
2021-12-27T19:00:32Z yngfynrjymow INFO: Setting up environment
2021-12-27T19:00:33Z yngfynrjymow INFO: Running 'terraform init'; workdir: /tmp/yngfynrjymow
2021-12-27T19:00:34Z yngfynrjymow DEBUG: Initializing modules...
2021-12-27T19:00:34Z yngfynrjymow DEBUG: - core in core
...
2021-12-27T19:04:12Z zmldx3bmkczf INFO: Setting up environment
2021-12-27T19:04:13Z zmldx3bmkczf INFO: Running 'terraform init'; workdir: /tmp/yngfynrjymow
2021-12-27T19:04:14Z zmldx3bmkczf DEBUG: Initializing modules...
2021-12-27T19:04:14Z zmldx3bmkczf DEBUG: - core in core
You see two learners in the track logs. The first with participant-id yngfynrjymow and the second with participant-id zmldx3bmkczf.
Other ways to find out a participant-id
To limit the log entries to the second learner, enter the following command with participant-id zmldx3bmkczf:
💻 Instruqt CLI
instruqt track logs --participant-id zmldx3bmkczf
↳ And now you will only see the log entries for the requested single play:
==> Finding track by slug: instruqt/kubernetes
==> Tailing logs for track 'instruqt/kubernetes' (ID: 1w8pib6cdmfl)
2021-12-27T19:04:12Z zmldx3bmkczf INFO: Setting up environment
2021-12-27T19:04:13Z zmldx3bmkczf INFO: Running 'terraform init'; workdir: /tmp/yngfynrjymow
2021-12-27T19:04:14Z zmldx3bmkczf DEBUG: Initializing modules...
2021-12-27T19:04:14Z zmldx3bmkczf DEBUG: - core in core
↳ The command continues to tail the logs—thus showing new log entries—until you cancel the command with Control+C (or Command+C on Mac).

Start viewing track logs at a certain time

To view track logs starting at a certain time, enter the following command:
💻 Instruqt CLI
instruqt track logs --since 2021-12-27T19:04:00Z
↳ And you see the log entries since the requested time:
==> Finding track by slug: instruqt/kubernetes
==> Tailing logs for track 'instruqt/kubernetes' (ID: 1w8pib6cdmfl)
2021-12-27T19:04:12Z zmldx3bmkczf INFO: Setting up environment
2021-12-27T19:04:13Z zmldx3bmkczf INFO: Running 'terraform init'; workdir: /tmp/yngfynrjymow
2021-12-27T19:04:14Z zmldx3bmkczf DEBUG: Initializing modules...
2021-12-27T19:04:14Z zmldx3bmkczf DEBUG: - core in core
The command continues to tail the logs—thus showing new log entries—until you cancel the command with Control+C (or Command+C on Mac).
You nailed viewing track logs. Which makes you a black belt content developer.