This is a k6 extension using the xk6 system.
xk6-output-error
is a k6 extension to add more information into StdErr k6. Moreover, you can send logs with errors in your Elasticsearch or other log storage system used for this vector.dev (config vector), filebeat, etc.
To build a k6
binary with this extension, first ensure you have the prerequisites:
- Go toolchain
- Git
Then:
- Install
xk6
:
go install go.k6.io/xk6/cmd/xk6@latest
- Build the binary:
CGO_ENABLED=1
xk6 build --with github.com/Tinkoff/xk6-output-error@latest
If you use Windows:
set CGO_ENABLED=1
xk6 build master --with github.com/Tinkoff/xk6-output-error
You can use default params:
k6 run -o xk6-output-error sample.js
Also, you can add special fields for output:
k6 run -o xk6-output-error=fields="proto,tls_version" sample.js
Or set an environment variable:
export K6_OUTPUTERROR_FIELDS="proto,tls_version"
k6 run -o xk6-output-error sample.js
Moreover, you can set output into a file:
k6 run -o xk6-output-error=fields="proto,tls_version" ./examples/sample.js 2>error.log