Is it possible to use the search command in DQL to mask or obfuscate certain information based on a pattern?
For example, I’d like to search logs that contain a credit card number and then mask part of it (e.g., show only the last 4 digits). Is there any built-in function or workaround in DQL that allows this kind of pattern-based masking or transformation?
the way search seems to work is check any value so in my example it would search “1234” anywhere in the card and if it hits show back all cc numbers that have “1234” otherwise you could just filter on the last4
Just to clarify — the credit card number was just an example. The real concern involves sensitive data in general, like user IDs, account numbers, etc. Of course, the best practice is to avoid logging this kind of information altogether, but unfortunately, that’s not our current reality. We have a large volume of logs where such data may appear, and we’re trying to find a way to proactively detect and mask it.
Regarding the examples shared so far: they’re helpful, but still not fully effective for our use case. The main challenge is that we don’t know the exact field names where the sensitive information might appear. That’s why we’re using search to filter based on patterns like “cardNumber”, “card number”, “card”, etc., to catch any record that contains those terms in any field.
What we need next is a way to use DPL to scan for numeric patterns (like potential card numbers or user IDs) within the matched records and then mask or obfuscate them — regardless of where they appear. That’s proving to be a complex task.
Has anyone tried something similar or found an efficient workaround for this kind of scenario?
Hey @m_zol ,
I just wanted to check in and see if you still need help with this. If so, I’d be happy to look into it for you! :blush:
Please let me know what works best for you.