Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/k6/next/results-output/real-time/csv.md, or by sending Accept: text/markdown to https://grafana.com/docs/k6/next/results-output/real-time/csv/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
CSV
You can output granular data points in CSV format.
To do so, use k6 run with the --out flag.
Pass the path for your CSV file as the flag argument:
k6 run --out csv=test_results.csv script.jsYou can also get the results gzipped, like this:
k6 run --out csv=test_results.gz script.jsTo inspect the output in real time, you can use a command like tail -f on the file you save:
tail -f test_results.csvCSV format
The CSV result file will look something like this:
metric_name,timestamp,metric_value,check,error,error_code,group,method,name,proto,scenario,status,subproto,tls_version,url,extra_tags
http_reqs,1595325560,1.000000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_duration,1595325560,221.899000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_blocked,1595325560,225.275000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_connecting,1595325560,217.680000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_tls_handshaking,1595325560,0.000000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_sending,1595325560,0.112000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_waiting,1595325560,220.280000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_receiving,1595325560,1.507000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
vus,1595325560,1.000000,,,,,,,,,,,,,
vus_max,1595325560,20.000000,,,,,,,,,,,,,
checks,1595325561,1.000000,status is 200,,,,,,,default,,,,,
checks,1595325561,0.000000,response body,,,,,,,default,,,,,
data_sent,1595325561,76.000000,,,,,,,,default,,,,,
data_received,1595325561,11045.000000,,,,,,,,default,,,,,
iteration_duration,1595325561,1449.049580,,,,,,,,default,,,,,
iterations,1595325561,1.000000,,,,,,,,default,,,,,Each entry in the report represents a metric, metric_name, along with its value, metric_value, at time, timestamp.
If an error happens, then the error along with the error_code fields will be populated.
CSV options
k6 provides a few options to help you configure your CSV output:
| option | Configures | Possible values | Default | Env. variable |
|---|---|---|---|---|
saveInterval | The time intervals at which k6 writes to the CSV | Either a string with time units("1m45s"), or a number of milliseconds | "1s" | K6_CSV_SAVE_INTERVAL |
timeFormat | The timestamp format | unix, unix_nano, unix_micro, unix_milli, rfc3339, rfc3339_nano | unix | K6_CSV_TIME_FORMAT |
fileName | The file name and path where output is saved | N/A | file.csv | K6_CSV_FILENAME |
Read more
Was this page helpful?
Related resources from Grafana Labs

