# Sensitive data masking

**URL:** <https://community.dynatrace.com/t/sensitive-data-masking/53742>\
**Category:** Open Q&A\
**Tags:** data-privacy-and-product-security, logs\
**Created:** [October 15, 2025, 5:41pm UTC](https://community.dynatrace.com/t/sensitive-data-masking/53742 "2025-10-15T17:41:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marusla](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marusla/32/24217_2.png) [@marusla](https://community.dynatrace.com/u/marusla)\
**Post date:** [October 15, 2025, 5:41pm UTC](https://community.dynatrace.com/t/sensitive-data-masking/53742/1 "2025-10-15T17:41:06Z")

</div>

Hello, can someone helpme, please, im trying to create an&nbsp;Search expression for hide some fields, like passport, id, an only showme the last 4 digit, can you helpme im trying with (.{4}) but this hide only the first 4 digit, but i want that showme the last 4

Here an examble of my log

Id/:124241244, Passport/:34455009986665

I want masking the number an show only de last 4 digit like:

Id/:\*1244, Passport/:\*6665

---

<div class="post-metadata">

**Author:** ![juan\_mesa](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@juan\_mesa](https://community.dynatrace.com/u/juan_mesa)\
**Post date:** [October 22, 2025, 11:09pm UTC](https://community.dynatrace.com/t/sensitive-data-masking/53742/2 "2025-10-22T23:09:05Z")

</div>

Hi Marusla,

Dynatrace’s sensitive data masking feature uses a simplified regular expression engine that doesn’t support advanced constructs such as lookaheads, lookbehinds, or backreferences those would help us to achieve the outcome you are desiring. Only standard expressions are supported — for example, you can safely mask entire numeric fields using a pattern such as:

(?:Id/:|Passport/:)(\d+)

This will replace the full number according the format you use for data masking type, in the example below I use the string format.

I believe that if you need to keep the last four digits visible, the masking must be applied before logs are sent to Dynatrace.

Hope this helps,

Best regards

 ![juan_mesa_0-1761173270105.png](https://global.discourse-cdn.com/dynatrace/original/3X/f/f/ff97afa2e18a277a723d02a02837fcdabf5cf2b8.png)

> **[Sensitive data masking in OneAgent](https://docs.dynatrace.com/docs/analyze-explore-automate/logs/lma-log-ingestion/lma-log-ingestion-via-oa/lma-sensitive-data-masking)**
>
> Mask sensitive information in your log data using Log Management and Analytics.
