Query Loki hide sensitive data

I have a log that contains sensitive data and I would like to hide this data in the log output.

example of the query.
{job=“example”, level=“error”} | json | line_format Message: {{.body}}

exit the query.
Message: error client whith cpf 1234567890 is not found

It is possible to hide sensitive data, I would like the output of the example above to be.
Message: error client whith cpf 123****890 is not found

Help please.

You really only have one option when it comes to sensitive data, not just in Loki, in any data storage platform, and that is to redact the sensitive part of your logs and data before sending it to your storage.

Yes, I think so too. But would it be possible to create a replace ? Do you have any example of a query with replace ? plz

How secure will be a query with “replace”?
Only visually. Average user can play with browser console and remove that “replace” from the query to get sensitive nonreplaced data.