> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-platform/use-harness-platform/delegates/delegate/manage-delegates/hide-logs-using-regex.md).

# Hide log information based on regex patterns

Harness sanitizes deployment logs and any script outputs to mask text secret values and JSON web tokens (JWTs) by default. For more information, go to [Secrets and log sanitization](/harness-platform/use-harness-platform/secrets/secrets-management/secrets-and-log-sanitization.md). You can mask other sensitive information from log streams using regular expressions based on your needs. This will remove the information you define from logs in the Harness UI.

{% hint style="info" %}
Harness Delegate version 24.01.82110 or later is required to use this feature.
{% endhint %}

To hide log information based on regex, do the following:

1. Create a `sanitize-patterns.txt` file in your local that contains all of the regexes that you want to hide in logs.

   This file can contain multiple regexes. Add each regex on a new line. In the example below, we have added two expressions.

   ```
   <CreditCard>.*?</CreditCard>
   <accountID>.*?</accountID>
   ```
2. Create the ConfigMap in the same namespace where you are installing the delegate.

   ```
   kubectl create configmap <CONFIGMAP_NAME> --from-file sanitize-patterns.txt -n <NAMESPACE>
   ```
3. Mount the volume under the `/opt/harness-delegate` path in your delegate YAML file.

   ```yaml
               volumeMounts:
              - name: "config"
                mountPath: "/opt/harness-delegate/sanitize-patterns.txt"
                subPath: sanitize-patterns.txt
          volumes:
            - name: "config"
              configMap:
                name: "<YOUR_CONFIGMAP_FILE_NAME>"
   ```
4. Apply the Kubernetes YAML.
