How to send own log message to loki using k6

im using the below script to send log message(“This is a test log message”)to loki,
my doubt is , is it possible to send our own logs to loki using xk6 extention?.
if yes is this script is correct?

but it is pushing auto generated logs to loki.

kindly help me to resolve this issue

import loki from ‘k6/x/loki’;

const conf = loki.Config(“http://localhost:3100”);
const client = loki.Client(conf);

export default function () {
const msg = “This is a test log message”;
const labels = {
“label_name”: “label_value”,
“label_name_2”: “label_value_2”

client.push(msg, labels);

Hey @chandrusanthosh01,
sorry for the slow reply.

Why are you looking for an extension? If your use case is only to push the script’s logs then this is already natively supported by k6.

You can read this blog’s article Using Loki to store and query k6 logs or the official documentation of the Loki log output.

I hope it helps.