k6

Console.log() in Kubernetes environment

When I ran the following code on my local machine with k6:
export default function() {
console.log(JSON.stringify({ key1: ‘value1’, key2: ‘value2’ }));
}
tt generates following output to console:
INFO[0000] {"key1":"value1","key2":"value2"}

However, when the same code is executed in our Kubernetes environment, it generates outputs with the message with double-quotations:
time="2019-07-17T15:41:14Z" level=info msg="{\"key1\":\"value1\",\"key2\":\"value2\"}"

I would like to generate output without double-quotations so that those values are ingested by logDNA (https://docs.logdna.com/docs/ingestion#section-json-parsing). Is there any way to skip those double-quotations in Kubernetes environment?

Tami

Found --logformat=raw option. It was what I was looking for.

2 Likes