How to log errors only once across VUs?


Just a quick question. I’d like the k6 output to show errors encountered in the test but at the same time not be spammy.

I have a sort of rudimentary solution in place where errors are only logged if the previous one was different and this works to a degree. The problem is that it works at the VU level. So if we have many VUs they will still all post the same error in the output once, still leading to a lot of repetition.

I gather there’s no easy solution to this but thought it worth asking, is there a way to only log errors once “globally”?


Unfortunately that’s not possible, sorry. Right now maybe you can use --logformat=json, forward the logs to a file, and then use some other tool to process them after the k6 run?

Feel free to open a new feature request issue for this! I admit that I am not even sure how such a feature would look like, given that error messages could be slightly different due to differences in URLs and port numbers and such, but it’s probably worth investigating.

Yeah thought that might be the case but that’s fair enough. Thanks!