You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
While querying loki logs, I'd like to decode the jwt tokens written in my logs.
In my case, the base64 encoded payload of the jwt tokens do not have their padding.
This gives a illegal base64 data at input byte .. when trying to base64-decode with b64dec.
Describe the solution you'd like
The b64dec template function would be more useful if it automatically accounts for missing padding in the base64 encoded string.
Describe alternatives you've considered
I could add missing padding myself as part of the logql query like this:
The text was updated successfully, but these errors were encountered:
dlemfh
changed the title
Make the b64dec logql template function automatically account for missing paddingb64dec (logql template function) should automatically account for missing padding
Dec 30, 2024
Is your feature request related to a problem? Please describe.
While querying loki logs, I'd like to decode the jwt tokens written in my logs.
In my case, the base64 encoded payload of the jwt tokens do not have their padding.
This gives a
illegal base64 data at input byte ..
when trying to base64-decode withb64dec
.Describe the solution you'd like
The
b64dec
template function would be more useful if it automatically accounts for missing padding in the base64 encoded string.Describe alternatives you've considered
I could add missing padding myself as part of the logql query like this:
But it's preferable to not have to add missing padding ourselves.
Additional context
Formula for automatically adding missing padding while decoding a base64-encoded string
s
:b64decode(s + b'=' * (-len(s) % 4))
I am willing to submit a PR that overrides
b64dec
functionality in https://github.com/grafana/loki/blob/main/pkg/logql/log/fmt.go, if it is agreed to move forward in this direction!The text was updated successfully, but these errors were encountered: