> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sawmills.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Mask Sensitive Data/PII Processor

> Identify and mask sensitive data like credit cards, SSNs, emails, and IP addresses in telemetry streams using the Sawmills Mask Processor with regex patterns.

## Supported Data Types

📘 **Logs**

### Configuring the Sawmills Mask Processor

The Sawmills Mask Processor enables you to identify and mask sensitive data within telemetry streams. This ensures data privacy and compliance with regulations.

### Mask Processor Features

#### Predefined Sensitive Data Types

The processor supports predefined sensitive data types. Users can select the following fields using checkboxes in the configuration interface:
<Note>**Note:** This processor searches across `Attributes`, `Resources`, and `Body`</Note>

#### Fields (Optional)

Select which predefined fields you want to mask within your data. These filters cover the most common types of personal information.

* **Credit Card Number**
* **Date of Birth (DOB)**
* **Email Addresse**
* **IPv4 Addresse**
* **IPv6 Addresse**
* **MAC Addresses**
* **Phone Number**
* **Social Security Number (SSN)**

#### Custom Rules (Optional)

Users can define additional filtering options in the **Custom Rules** section. This section allows users to create their own patterns using:

* **Contains**: Simple string patterns.
* **Matches Regex**: Complex patterns for specific formats not covered by the default filters.

### Example Custom Rules

Below are example regular expressions that can be used in the **Custom Rules** section:

* **Phone Numbers**:
  * International: `(?:\+?\d{1,4}[\s-]?)?(?:\(?\d{1,4}\)?[\s-]?)?\d{1,4}[\s-]?\d{1,4}(?:[\s-]?\d{1,9})?`

* **Other Personal Numbers (non SSN)**:
  * Canada (SIN): `\b\d{3}-\d{3}-\d{3}\b`
  * France (INSEE): `\b\d{1}\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{3}\s?\d{3}\b`
  * Sweden (Personnummer): `\b(?:\d{6}|\d{8})-\d{4}\b`
  * South Korea (Resident Registration Number): `\b\d{6}-\d{7}\b`
  * Finland (Personal Identity Code): `\b\d{6}[-+A]\d{3}[0-9A-Za-z]\b`
  * Germany (Tax ID): `\b\d{2}\s?\d{3}\s?\d{3}\s?\d{3}\b`

* **Date of Birth (DOB)**:
  * `YYYY-MM-DD`: `\b(19|20)\d{2}[-/](0[1-9]|1[0-2])[-/](0[1-9]|[12]\d|3[01])\b`
  * `DD/MM/YYYY or MM/DD/YYYY`: `\b(0[1-9]|[12]\d|3[01])[-/](0[1-9]|1[0-2])[-/](19|20)\d{2}\b`

* **Credit Card Numbers (Extended)**:
  * (Visa, Mastercard, American Express, Diners Club): `\b(?:4\d{3}|5[1-5]\d{2}|6(?:011|5\d{2})|3[47]\d{2}|3(?:0[0-5]|[68]\d)|2(?:2[2-9]|[3-7]\d)\d{2})[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{1,4}\b`

***

### Implementation Notes

* Regular expressions provided above are pre-tested but should be verified for edge cases.
* Masking should occur prior to data storage or transmission to ensure compliance.
* Ensure performance and accuracy by limiting custom regex patterns to those absolutely necessary.
