promtail-client icon indicating copy to clipboard operation
promtail-client copied to clipboard

[Feature request] set additional labels per log entry

Open yacut opened this issue 4 years ago • 3 comments

Right now, labels can only be set during client initialization. It would be very useful if you could set additional labels to individual messages. e.g.:

loki.InfoWithLabelf("{worker_id=\"123\"}", "source = %s, time = %s, i = %d\n", source_name, tstamp, i)

yacut avatar Jan 11 '21 11:01 yacut

Hi @yacut

Many thanks for the suggestion and also for the interest to the project.

Unfortunately currently I'm a little short on spare time to implement this feature, but I will be happy to merge a corresponding pull request.

afiskon avatar Jan 11 '21 11:01 afiskon

Commenting in 2022 to say that this is still a relevant feature request. Thanks

gatlee21 avatar Jan 28 '22 14:01 gatlee21

I just submit a pr that allow pass a parameter to change label every time. Please check that and thank you so much. https://github.com/afiskon/promtail-client/pull/6

laikee99 avatar Jun 05 '22 10:06 laikee99