Hi everyone, I’ve 2 small questions. In k6, is it possible to:
- split the CSV output into multiple files? I want to generate unique CSV file for each API test.
- customize the CSV content e.g reordering columns, removing certain metrics etc?
Hi everyone, I’ve 2 small questions. In k6, is it possible to:
Hi @demon6656, welcome to the forum!
I don’t really know, what is your exact situation, so I try to give you some ideas:
Acording to the CSV output documentation (and I also looked in the source code) I don’t think currently you can split or filter the csv output out of the box. I have the following ideas to solve such issue:
You can save the csv into a file, and postprocess it after test run. e.g. on linux you can reorder and filter the csv columns with awk:
awk -F, '{ print $1","$7","$2","$5 }' file.csv
you can filter out specific metrics with grep
grep -v 'data_sent' file.csv
or something like that
OR
You can write your own custom output extension in golang, build it into the k6 binary with xk6. You get all the metrics and samples in that extension, and you can format, filter, save, split the data programmatically. Output Extensions
OR
If you are not familiar with golang, you can use the xk6-output-plugin extension and write your ouptut plugin in javascript or python (or maybe any other programming language)
I hope my answer helps.
All right. I’ll check them out 1 by 1. Thanks!