0

I want to configure a multi-line processor using PLG stack (Promtail, Loki & Grafana) with Quarkus services. I am following this link to do so, but I am unable to inject the zero-width-character in my quarkus-app/application.properties file: it either print it as is or replace it with a ?. Here is what I tried so far :

quarkus.log.console.format=U+200B%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n

quarkus.log.console.format=​%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n

Any ideas ?

iabughosh
  • 481
  • 5
  • 19

1 Answers1

0

I am not sure why that isn't working for you - you could try the alternate representations such as ​ or ​ or perhaps the java Unicode \u200B e.g.

quarkus.log.console.format=\u200B%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n

If none of those work and you can't get any Zero-width space to render as you like then as the document says...

"Any special character that is unlikely to be part of your regular logs should do just fine"

So perhaps you could just tilde ~, or asterisk *, or some other non alpha-numeric symbol?

e.g.

tilde

quarkus.log.console.format=~{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n

Edit: you could also just paste a Zero-width space in - but obviously it will look like there is nothing there :)

quarkus.log.console.format=​{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n

example of pasted zero-width space

Fraser
  • 15,275
  • 8
  • 53
  • 104
  • Did you try it before ? I tried all the above with no luck! Also I can't bet to replace random special character like what you suggested: if there is another match in the same line it will be splitted into separate line in Loki/Grafana. – iabughosh Sep 27 '22 at 12:05
  • @iabughosh - hmm I see what you mean, but `Zero-width space` is also just a "random special character" - and you know 100% that it won't be in the log right? So then surly there should be others too...I mean - take your pick! - https://en.wikipedia.org/wiki/List_of_Unicode_characters - `ɏ`, `☔`, `⛇` etc – Fraser Sep 27 '22 at 12:47
  • If I want to think of a way it maybe 2 or 3 special characters combination but definitely not one special char. – iabughosh Sep 27 '22 at 13:25
  • @iabughosh - but `Zero-width space` is just one special char - so you are basically saying that won't work either? There is nothing "magic" about that particular char except that it is a `non-printing character`. Thinking about it - you could also try and paste it in (although it will look like it isn't there) see my edit. – Fraser Sep 27 '22 at 13:51
  • 1
    What I am saying is the zero-width space characters is not working in any form, so I may do something like '~#' as a multiline indicator – iabughosh Sep 27 '22 at 13:59