Inspect logs
Logs are messages you can add to your test script to help you debug tests.
Log methods
You can use the following logging methods:
console.log()console.info()console.warn()console.error()console.debug()- Only shown when running k6 with the
-v/--verboseflag.
- Only shown when running k6 with the
To view all the logs for a test run, click the Logs tab. Depending on the method you’re using, a green, yellow, or red marking is displayed next to each log.
You can select a log message to expand it and see more details such as:
- instance_id
- level
- lz (load zone)
- source
- test_run_id
You can also filter the list by using:
- Filter: Filter by text in the log message.
- Level: Choose from the different level options.
- Info:
console.logandconsole.info. - Debug:
console.debug. - Warning:
console.warning. - Error:
console.error.
- Info:
- Load zone: Choose from the different load zones used in the test run.
Limitations
Grafana Cloud k6 has a limit of 10 messages per second for log lines. If you exceed this limit, k6 shows a warning with the number of discarded log lines.
While logs can help you debug a script or test results, they shouldn’t replace k6 API functions. It’s often an anti-pattern to use logs in the following ways:
- Track a condition status. Instead, use Checks to assert conditions.
- Track a variable value during the test execution. Instead, use the Trend metric.
You should also not rely on logging to interpret or analyze the performance of your system.
Was this page helpful?
Related resources from Grafana Labs


