With ktor logging headers (`LogLevel.HEADERS`) app...
# ktor
r
With ktor logging headers (
LogLevel.HEADERS
) application/customer secrets in the auth header are logged as below. I’d like to redact these secrets, as
******
. Has anyone found a non-invasive way of doing this?
Copy code
[***] 2022-02-22 08:59:45.641 [main] INFO  io.ktor.client.HttpClient - METHOD: HttpMethod(value=GET)
  [***] 2022-02-22 08:59:45.641 [main] INFO  io.ktor.client.HttpClient - COMMON HEADERS
  [***] 2022-02-22 08:59:45.641 [main] INFO  io.ktor.client.HttpClient - -> Accept: application/json
  [***] 2022-02-22 08:59:45.641 [main] INFO  io.ktor.client.HttpClient - -> Accept-Charset: UTF-8
  [***] 2022-02-22 08:59:45.641 [main] INFO  io.ktor.client.HttpClient - -> Authorization: token my_super_secret_token_that_I_want_to_redact
m
If you can accurately predict where the secrets would appear, you could intercept the logging calls manually and block out the secrets. It not necessarily clean but it should work.
r
Exactly what I was looking for Matthew. And thanks for the example!