Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple log outputs #2287

Open
codebien opened this issue Dec 6, 2021 · 1 comment
Open

Multiple log outputs #2287

codebien opened this issue Dec 6, 2021 · 1 comment
Labels
evaluation needed proposal needs to be validated or tested before fully implementing it in k6 feature

Comments

@codebien
Copy link
Contributor

codebien commented Dec 6, 2021

Feature Description

It could be useful to declare multiple log outputs at the same time for k6 run and cloud commands.

k6 run --logformat json \
    --log-output file=./k6run.log \
    --log-output loki=http://127.0.0.1:3100/loki/api/v1/push \
    ./samples/http_get.js

or a more advanced example

k6 run --verbose \
    --log-output "stdout,level=info" \
    --log-output "file=all.log,level=debug" \
    --log-output "loki=http://whatever,level=warn" \
    ./samples/http_get.js

Logformat

It could include the additional features for making more fine-grained logformat configuration considering that at the moment logformat can be only defined at the global layer.

  • a per-output logformat option for a fine-grained definition of the format for the specific output

An example with the previous advanced example:

k6 run --verbose \
    --log-output "stdout,level=info,format=raw" \
    --log-output "file=all.log,level=debug,format=json" \
    --log-output "loki=http://whatever,level=warn,format=json" \
    ./samples/http_get.js

Cloud

The cloud supports the log-output option and it shouldn't be confused as did during an internal discussion with show logs option.

k6 has its own debug log messages that are not driven from the script console.log(), just run k6 run --verbose or k6 cloud --verbose with a script without any console.log() calls and you'll see them.

so the following example is still a valid case:

k6 cloud --verbose --log-output "file=debug.log" --show-logs=false script.js

Already existing or connected issues / PRs (optional)

@codebien codebien added feature evaluation needed proposal needs to be validated or tested before fully implementing it in k6 labels Dec 6, 2021
@na--
Copy link
Member

na-- commented Mar 7, 2022

This and #1939 should be much easier to do after #2412 (and its connected PRs). It wasn't all that difficult before, to be fair, but now we should actually be able to test it easily and reliably.

Also, somewhat connected to #2414 (comment), we should slightly refactor how k6 waits for logs to be done... Though a WaitGroup will probably be better than a channel for multiple logs...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
evaluation needed proposal needs to be validated or tested before fully implementing it in k6 feature
Projects
None yet
Development

No branches or pull requests

2 participants