Links

View track logs

Look behind the curtains.
When a learner plays a track, events such as a sandbox provisioning, setup scripts, and more are captured within track logs. You view track logs from the Instruqt CLI or the Web UI.
Overview of track logs

Debugging

Track logs are helpful for debugging. They will indicate whether your sandbox hosts are provisioning properly, and if your Lifecycle scripts are executing with the expected behaviour - amongst other things. Consider the following example, which shows the logs of a track starting up:
1
==> Finding track by slug: instruqt/kubernetes
2
==> Tailing logs for track 'instruqt/kubernetes' (ID: 1w8pib6cdmfl)
3
2021-12-27T19:00:32Z yngfynrjymow INFO: Setting up environment
4
2021-12-27T19:00:33Z yngfynrjymow INFO: Running 'terraform init'; workdir: /tmp/yngfynrjymow
5
2021-12-27T19:00:34Z yngfynrjymow DEBUG: Initializing modules...
6
2021-12-27T19:00:34Z yngfynrjymow DEBUG: - core in core
7
2021-12-27T19:00:34Z yngfynrjymow DEBUG: - shell in container
8
2021-12-27T19:00:34Z yngfynrjymow DEBUG: - workstation in container
9
2021-12-27T19:00:34Z yngfynrjymow DEBUG:
10
2021-12-27T19:00:34Z yngfynrjymow DEBUG: Initializing the backend...
11
2021-12-27T19:00:34Z yngfynrjymow DEBUG:
12
2021-12-27T19:00:34Z yngfynrjymow DEBUG: Initializing provider plugins...
13
2021-12-27T19:00:34Z yngfynrjymow DEBUG:
14
2022-12-27T19:00:34Z yngfynrjymow DEBUG: module.core.kubernetes_namespace.participant: Creating...
15
2022-12-27T19:00:34Z yngfynrjymow DEBUG: module.core.kubernetes_namespace.participant: Creation complete after 0s [id=zmldx3bmkczf]
16
2021-12-27T19:00:34Z yngfynrjymow DEBUG:
17
2021-12-27T19:00:34Z yngfynrjymow DEBUG: Outputs:
18
2021-12-27T19:00:34Z yngfynrjymow DEBUG:
19
2021-12-27T19:00:34Z yngfynrjymow DEBUG: alicloud_accounts = []
20
2021-12-27T19:00:34Z yngfynrjymow DEBUG: aws_accounts = []
21
2021-12-27T19:00:34Z yngfynrjymow DEBUG: azure_subscriptions = []
22
2021-12-27T19:00:34Z yngfynrjymow DEBUG: gcp_projects = []
23
2021-12-27T19:02:02Z yngfynrjymow INFO: All scripts completed for action: setup
24
2021-12-27T19:02:02Z yngfynrjymow INFO: Executing action: setup for challenge: pjdxmwz493v7
25
2021-12-27T19:02:14Z yngfynrjymow INFO: Starting script: setup-container
26
2021-12-27T19:02:14Z yngfynrjymow INFO: setup-container: + echo the participant is nglaz9e9zqoz
27
2021-12-27T19:02:14Z yngfynrjymow INFO: setup-container: the participant is nglaz9e9zqoz
28
2021-12-27T19:02:14Z yngfynrjymow INFO: Finished running script: setup-container
29
2021-12-27T19:02:14Z yngfynrjymow INFO: All scripts completed for action: setup
30
2021-12-27T19:03:37Z yngfynrjymow INFO: Executing action: check for challenge: pjdxmwz493v7
31
2021-12-27T19:03:37Z yngfynrjymow INFO: Starting script: check-container
Track logs include output from track setup and track cleanup scripts, as well as challenge setup, challenge check, and challenge cleanup scripts.
Within track logs, there are two types of log entries: INFO and DEBUG.
  • INFO entries contain details of the backend script execution. Like in lines 3 and 4, and 23 to 31 of the example.
  • DEBUG entries contain details of initializing the backend and plugins (lines 5 to 12), loading modules (lines 14 and 15), and showing variable values o(lines 17 to 22.
Furthermore, note the participant-id yngfynrjymow that identifies which learner played the track.

Viewing track logs

Instruqt CLI

From the Instruqt CLI, you can view track logs with the instruqt track logs command. Consider the following example, which trails the logs for a track with a slug of my-track-1:
instruqt track logs my-track-1
==> Finding track by slug: instruqt/my-track-1
==> Tailing logs for track 'instruqt/my-track-1' (ID: 1w8pib6cdmfl)
...
Alternatively, if you enter a local track directory on your system, you can omit a track slug at the end of the command:
cd my-track-1/
instruqt track logs
==> Finding track by slug: instruqt/my-track-1
==> Tailing logs for track 'instruqt/my-track-1' (ID: 1w8pib6cdmfl)
...
The instruqt track logs command continues to tail the logs—thus showing new log entries—until you cancel the command with Control+C (or Command+C on Mac).

Instruqt CLI Parameters

The instruqt track logs command accepts several parameters to filter which logs are outputted, including --since and --participant-id. You can read about all of the parameters in the CLI References section.
For example, the following command filters logs to a specific participant ID, over the last 3 hours:
instruqt track logs my-track-1 --since 3h --participant-id zmldx3bmkczf
==> Finding track by slug: instruqt/my-track-1
==> Tailing logs for track 'instruqt/my-track-1' (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
How do I determine a participant ID of a user?
  • If there is a terminal available in the track of which you want the participant-id: Enter the following command in the terminal: echo $INSTRUQT_PARTICIPANT_ID ↳ The participant-id will be outputted.
  • If you know the invite-id of the track: Enter the following Instruqt CLI command to get the current learners of the track: instruqt active-users --invite-id INVITE_ID ⇨ Replace INVITE_ID with your invite-id. ↳ And you will see a list like this:
LAST ACTIVITY TRACK CHALLENGE PARTICIPANT ID USER
----------------------------+--------------------+----------------------------+----------------+-----------------------------------------------
2021-12-27T19:04:12+01:00 instruqt/kubernetes deploying-nginx (1/4) x9fso4o4kgsz "Jane Doe" [email protected]
----------------------------+--------------------+----------------------------+----------------+-----------------------------------------------

Web UI

From the Web UI, you can view a track's logs by opening a track and selecting View track logs. ↳ This opens the Logs page. Optionally specify which logs you wish to see by changing the Since, Severity, and Participant fields, then select Apply. Assuming tracks are being used, logs will begin to appear.
Logs page of a track
You nailed viewing track logs, which makes you a black belt content developer.