# Sanitizing pt-query-digest output

**URL:** https://forums.percona.com/t/sanitizing-pt-query-digest-output/35800
**Category:** Percona Toolkit
**Tags:** mysql
**Created:** [December 25, 2024, 8:05am UTC](https://forums.percona.com/t/sanitizing-pt-query-digest-output/35800 "2024-12-25T08:05:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Idan\_Ahal](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/idan_ahal/32/13477_2.png) [@Idan\_Ahal](https://forums.percona.com/u/Idan_Ahal)
#### Post date: [December 25, 2024, 8:05am UTC](https://forums.percona.com/t/sanitizing-pt-query-digest-output/35800/1 "2024-12-25T08:05:43Z")

</div>

I’m using the pt-query-digest tool to understand and explore our MySQL server. The problem is that I want to share the results but I have been told that I need to sanitize the report results before sharing it with colleagues. Is there a way to do so?

For example, the where section can hold clients data for example where ip=client\_ip

---

<div class="post-metadata">

### Author: ![lalit.choudhary](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lalit.choudhary/32/51_2.png) [@lalit.choudhary](https://forums.percona.com/u/lalit.choudhary)
#### Post date: [December 25, 2024, 11:14am UTC](https://forums.percona.com/t/sanitizing-pt-query-digest-output/35800/2 "2024-12-25T11:14:41Z")

</div>

Hello @Idan_Ahal

> [@Idan\_Ahal](#):
>
> I’m using the pt-query-digest tool to understand and explore our MySQL server. The problem is that I want to share the results but I have been told that I need to sanitize the report results before sharing it with colleagues. Is there a way to do so?
> 
> For example, the where section can hold clients data for example where ip=client\_ip

This is a customization request; you can use tools like sed,awk, etc, to replace strings. There are multiple things in slow query digest reports like table name, column name, etc.

In this case, You can focus on a few slow queries and replace the strings you want and share it.

---

<div class="post-metadata">

### Author: ![Idan\_Ahal](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/idan_ahal/32/13477_2.png) [@Idan\_Ahal](https://forums.percona.com/u/Idan_Ahal)
#### Post date: [December 26, 2024, 12:51pm UTC](https://forums.percona.com/t/sanitizing-pt-query-digest-output/35800/3 "2024-12-26T12:51:16Z")

</div>

I’m creating an automation piplene so I can not do it myself. Most of the problem is with the ‘where’ section. Do you have any idea how can I do it?

---

<div class="post-metadata">

### Author: ![Agustin\_G](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/agustin_g/32/14111_2.png) [@Agustin\_G](https://forums.percona.com/u/Agustin_G)
#### Post date: [December 27, 2024, 4:53pm UTC](https://forums.percona.com/t/sanitizing-pt-query-digest-output/35800/4 "2024-12-27T16:53:03Z")

</div>

Hi @Idan_Ahal,

An alternative is to set up Percona Monitoring and Management (PMM) in this node, and use the Query Analytics (QAN) feature:

> **[Percona Monitoring and Management - Query Analytics](https://docs.percona.com/percona-monitoring-and-management/get-started/query-analytics.html)**
>
> The Query Analytics dashboard shows how queries are executed and where they spend their time. It helps you analyze database queries over time, optimize database performance, and find and remedy the source of problems.

With QAN you can benefit from queries being sent to the PMM server without this data to begin with.

Setting up and maintaining PMM is not as trivial as using pt-query-digest, but it will provide much more data and functionality, and you won’t need to manually tune the digest outputs (which is error prone and more labor intensive).

I hope this helps.
