View track logs
Using the CLI, you can view a log stream that shows Instruqt backend setup script output, as well as the output of your check, cleanup and setup scripts.
Run the instruqt track logs command inside of a track directory. This command will continue to tail the logs until you cancel it with CTRL+C
1
$ instruqt track logs
2
==> Tailing logs for track 'acmecorp/my-track' (ID: hogfljy9kccc)
3
2018/09/14 11:13:17 INFO: h84attob7rnw-8c64aa11957d79c2c40f3fb1b9d1096a: - module.core
4
2018/09/14 11:13:17 INFO: h84attob7rnw-8c64aa11957d79c2c40f3fb1b9d1096a: Initializing the backend...
5
...
Copied!

Tailing the logs of remote tracks

You don't need to have the track configuration files on your local machine to read track logs. You can pass the track slug to stream the logs from any track.
1
instruqt track logs my-track
Copied!

Filtering the log output to a single play

The instruqt track logs output is a combined stream of log data from all of the current plays for a track. This can be overwhelming when you have multiple users on your track at the same time. You can filter the log output to a single participant ID like this:
1
instruqt track logs --participant-id yngfynrjymow
Copied!

Making sense of the log output

Instruqt track logs include output from the backend scripts that stand up the sandbox, as well as the output from your lifecycle scripts. Below is an example of a track that has just been started. Note the participant id yngfynrjymow. The Instruqt platform uses Terraform to stand up all your VMs, containers, and cloud accounts.
1
==> Finding track by slug: instruqt/instruqt-cli-getting-started
2
==> Tailing logs for track 'instruqt/instruqt-cli-getting-started' (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...
Copied!
Once the Instruqt backend setup is complete you'll see the Terraform run complete and show any cloud accounts that were created:
1
2021-12-27T19:01:05Z yngfynrjymow DEBUG: Apply complete! Resources: 11 added, 0 changed, 0 destroyed.
2
2021-12-27T19:01:05Z yngfynrjymow DEBUG:
3
2021-12-27T19:01:05Z yngfynrjymow DEBUG: Outputs:
4
2021-12-27T19:01:05Z yngfynrjymow DEBUG:
5
2021-12-27T19:01:05Z yngfynrjymow DEBUG: alicloud_accounts = []
6
2021-12-27T19:01:05Z yngfynrjymow DEBUG: aws_accounts = []
7
2021-12-27T19:01:05Z yngfynrjymow DEBUG: azure_subscriptions = []
8
2021-12-27T19:01:05Z yngfynrjymow DEBUG: gcp_projects = []
Copied!
As soon as the Instruqt sandbox setup is complete the track_scripts setup scripts are run. This output can go on for quite a while, especially if you are installing packages on the host. Here's a snippet from the log showing the setup-shell script being run. This is the setup script for a host called shell.
Tip: Installing software packages during track startup is ok for development but it is strongly recommended that you build an image with all your software packages pre-installed. This ensures fast track startup times and reduces the risk of upstream issues preventing your track from starting.
1
2021-12-27T19:01:05Z yngfynrjymow INFO: Starting script: setup-shell
2
2021-12-27T19:01:05Z yngfynrjymow INFO: setup-shell:
3
2021-12-27T19:01:05Z yngfynrjymow INFO: setup-shell: WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
4
2021-12-27T19:01:05Z yngfynrjymow INFO: setup-shell:
5
2021-12-27T19:01:06Z yngfynrjymow INFO: setup-shell: Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
6
2021-12-27T19:01:06Z yngfynrjymow INFO: setup-shell: Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Copied!
After the track starts successfully, you'll begin to see log output from the individual challenge lifecycle scripts.
You can use echo commands in your lifecycle scripts to help with debugging.
Another useful trick is to start your script with the -x flag to show verbose log output. The -x flag may be placed at the top of your script on the "shebang" line like this:
#!/bin/bash -x
Last modified 15d ago