# \[Q\] - How to mask IPv6 on ingestion

**URL:** <https://community.dynatrace.com/t/q-how-to-mask-ipv6-on-ingestion/46846>\
**Category:** DQL\
**Tags:** dql, log-processing\
**Created:** [July 26, 2024, 11:40am UTC](https://community.dynatrace.com/t/q-how-to-mask-ipv6-on-ingestion/46846 "2024-07-26T11:40:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark\_forrester](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_forrester/32/12542_2.png) [@mark\_forrester](https://community.dynatrace.com/u/mark_forrester)\
**Post date:** [July 26, 2024, 11:40am UTC](https://community.dynatrace.com/t/q-how-to-mask-ipv6-on-ingestion/46846/1 "2024-07-26T11:40:42Z")

</div>

Hi Community

I’m trying to mask a IPv6 address on log ingestion but struggling to get the commad right

I find the IPv6 in the logs using the following command  
// detect ip  
| parse content, “LD IPADDR:ip LD”  
| fieldsAdd ip = if(ipIsPublic(ip), ip, else: null)

However when trying to mask using a similar command I get the below error, can anyone advise the right command to mask a IPv6 detected string in a log entry.

USING(INOUT content)  
| PARSE (content,“LD IPADDR:ip LD”)  
| FIELDS\_ADD(content: REPLACE\_PATTERN(content, ip,“\*\*\* DT MASKING \*\*\*”))

 ![mark_forrester_0-1721993998283.png](https://global.discourse-cdn.com/dynatrace/original/3X/6/3/63feaf6ac843a3676018a8c8e37acb07ecf735ac.png)

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [July 26, 2024, 2:55pm UTC](https://community.dynatrace.com/t/q-how-to-mask-ipv6-on-ingestion/46846/2 "2024-07-26T14:55:41Z")

</div>

Hi,

Maybe, can you share some logs lines content where you want to extract that information?

Best regards

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [July 26, 2024, 9:00pm UTC](https://community.dynatrace.com/t/q-how-to-mask-ipv6-on-ingestion/46846/3 "2024-07-26T21:00:11Z")

</div>

Hello [@mark\_forrester](https://community.dynatrace.com/user/17999)&nbsp; Hope it helps

 ![DanielS_0-1722027559099.png](https://global.discourse-cdn.com/dynatrace/original/2X/5/5894faf7b6403db872d49bccc365881003830e17.png)

Is not ingestion but does the same job

---

<div class="post-metadata">

**Author:** ![mark\_forrester](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_forrester/32/12542_2.png) [@mark\_forrester](https://community.dynatrace.com/u/mark_forrester)\
**Post date:** [July 29, 2024, 8:14am UTC](https://community.dynatrace.com/t/q-how-to-mask-ipv6-on-ingestion/46846/4 "2024-07-29T08:14:53Z")

</div>

Here is an edited sample content output in DT&nbsp;[@DanielS](https://community.dynatrace.com/user/35788)&nbsp;your example fails on this example as no matches found.

{ “log-type”:“access”, “domain”:“@domain\_name@”, “time”:“2024-07-29T08:03:53.435Z”, “process”:“582”, “filename”:“/var/www/html/rb\_bf61376cao”, “remoteIP”:“2a00:2a00:6416:5d01:51bb:1d00:e019:92c1”, “x-forwarded-for”:“-”, “host”:“[www.ourdomain.co.uk](http://www.ourdomain.co.uk)”, “request”:“/rb\_bf61376cao”, “query”:“?type=js3&sn=v\_4\_srv\_1\_sn\_89E82F0035A9458ED42E462151D39F6F\_mvisitor\_1724274919\_msn\_4-2D0\_perc\_100000\_ol\_0\_mul\_1\_app-3Afc8a255d717e7ed8\_1\_rcs-3Acss\_0&svrid=1&flavor=post&vi=PDHUTTNIVUULRVNDHPMLWCCVTKRBRRKR-0&modifiedSince=1722019465728&rf=https%3A%2F%[2Fwww.ourdomain.co.uk](http://2Fwww.ourdomain.co.uk)%2Fpubdeals%3Futm\_source%3Dsizzlapp%26utm\_medium%3Dapp%23%2F&bp=3&app=fc8a255d717e7ed8&crc=3798105690&en=l3f8ysai&end=1”, “method”:“POST”, “status”:“200”, “userAgent”:“Mozilla/5.0 (Linux; Android 14; SM-A528B Build/UP1A.231005.007; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/126.0.6478.134 Mobile Safari/537.36”, “referer”:“[https://www.ourdomain.co.uk/pubdeals?utm\_source=sizzlapp&utm\_medium=app](https://www.ourdomain.co.uk/pubdeals?utm_source=sizzlapp&utm_medium=app)” },

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [July 31, 2024, 7:43pm UTC](https://community.dynatrace.com/t/q-how-to-mask-ipv6-on-ingestion/46846/5 "2024-07-31T19:43:59Z")

</div>

Hello [@mark\_forrester](https://community.dynatrace.com/user/17999)&nbsp;using this regex in regex101 works perfect with all examples:

```python
(?:[a-fA-F0-9]{1,4}:){7}[a-fA-F0-9]{1,4}

```

 ![DanielS_2-1722454977449.png](https://global.discourse-cdn.com/dynatrace/original/2X/b/b46212289e33ae589fbf4e1399a25ff7c2e282b4.png)

and also in Dynatrace:

 ![DanielS_1-1722454961683.png](https://global.discourse-cdn.com/dynatrace/original/3X/8/8/8825a5639a9d287f2981ef381339dd8c7d0ae782.png)

let me know how it goes.

---

<div class="post-metadata">

**Author:** ![mark\_forrester](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_forrester/32/12542_2.png) [@mark\_forrester](https://community.dynatrace.com/u/mark_forrester)\
**Post date:** [August 1, 2024, 7:33am UTC](https://community.dynatrace.com/t/q-how-to-mask-ipv6-on-ingestion/46846/6 "2024-08-01T07:33:07Z")

</div>

Thank you this works a treat&nbsp;😁
