Replace private data in every span and score before it is stored, with —mask.
With --mask, the server replaces private data in every span and score before it is stored. No file of the store holds the original text, and no search finds it. It is off by default.
send-trace.sh puts the text into two spans (the agent run and the model call): two matches of email, and the address is found by no search.
Built-in rules: email, credit_card (with the Luhn check), ipv4, phone (only numbers that start with +), secret (key shapes such as sk-..., AWS key ids, GitHub and Slack tokens, JWTs, Bearer ..., PEM keys). Each is narrow on purpose. None finds names of people. A pattern is a regex of the Rust regex crate.
A wrong policy stops the start, with the name of the rule. A write never fails because of the policy.
GET /v1/mask gives counts only. It gives no value.
Masked: input, output, error, every text value in attributes and events, and the label and comment of a score. Not masked: ids (also userId and sessionId), name, kind, model, service, environment, tags, attribute keys, numbers. Do not put private data there.
A new policy changes new writes only. For old data, use the deletes.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Magpie","description":"Magpie is a trace store for AI agents: full-text search over prompts and replies, whole-trace queries and token and cost sums, in one Rust engine. A library for Rust, Node.js and Python, or one server that takes OpenTelemetry.","colors":{"primary":"#8A5A00","light":"#FFE83A","dark":"#8A5A00"},"logo":{"light":"https://mintcdn.com/magpie-f30b9567/lfS8S2tPtzbDfpXA/logo/light.svg?fit=max\u0026auto=format\u0026n=lfS8S2tPtzbDfpXA\u0026q=85\u0026s=6974f4dc1ead619990c46e61fa4c1569","dark":"https://mintcdn.com/magpie-f30b9567/lfS8S2tPtzbDfpXA/logo/dark.svg?fit=max\u0026auto=format\u0026n=lfS8S2tPtzbDfpXA\u0026q=85\u0026s=157f6921ea9b76c531444e3f6a94842c","href":"https://magpiedb.com"},"favicon":"https://mintcdn.com/magpie-f30b9567/lfS8S2tPtzbDfpXA/favicon.svg?fit=max\u0026auto=format\u0026n=lfS8S2tPtzbDfpXA\u0026q=85\u0026s=30258f3a311559908d00d02444a3e371","background":{"color":{"dark":"#0B0B0A"}},"navbar":{"links":[{"href":"https://github.com/intojhanurag/magpie","type":"github"}],"primary":{"type":"button","label":"Quick start","href":"/quickstart"}},"footer":{"socials":{"github":"https://github.com/intojhanurag/magpie","website":"https://magpiedb.com"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"markdown":{"instructions":["Magpie is a trace store for AI agents, used as a library (crate `magpiedb`, npm `magpiedb`, PyPI `magpiedb`) or as `magpie-server`, which takes OpenTelemetry (OTLP over HTTP on 127.0.0.1:4318 and gRPC on 127.0.0.1:4317 by default).","Use only the commands, flags, routes and JSON shapes that these pages show. Do not guess a flag or a query field: if a page does not show it, say that the docs do not show it.","Packages and server binaries are not published yet: build from source, as the quick start shows. Check the status note on the introduction page before you suggest `cargo add`, `npm install` or `pip install`.","Only one process may write to a store folder at a time. For many apps, send traces to one `magpie-server`."]},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"magpie-f30b9567","hasAudioNarration":false,"actualSubdomain":"magpie-f30b9567","customDomains":[],"gitSource":{"type":"github","owner":"intojhanurag","repo":"magpie","deployBranch":"main","contentDirectory":"docs-site","isPrivate":true,"mountPath":"","label":"","_id":"6b14f45b6b767715287f4264"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b14f76b3c71e4bc394dbb70","clientVersion":"0.0.4458","searchFilterCounts":[{"language":"default","tag":"Run in production","count":11},{"language":"default","tag":"Queries","count":8},{"language":"default","tag":"Server reference","count":7},{"language":"default","tag":"Get started","count":5},{"language":"default","tag":"Libraries","count":3},{"language":"default","tag":"Benchmarks","count":1},{"language":"default","tag":"Send traces","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"operations/masking","slug":"/operations/masking","pageMetadata":{"title":"Masking private data","sidebarTitle":"Masking","description":"Replace private data in every span and score before it is stored, with --mask.","href":"/operations/masking"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Replace private data in every span and score before it is stored, with —mask.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`With `,_jsx(_components.code,{children:`--mask`}),`, the server replaces private data in every span and score `,_jsx(_components.strong,{children:`before`}),` it is stored. No file of the store holds the original text, and no search finds it. It is off by default.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`cat`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` mask.json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`'EOF'`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`{`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"rules\": [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` {\"builtin\": \"email\"},`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` {\"builtin\": \"secret\"},`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` {\"builtin\": \"credit_card\", \"replace\": \"\u003ccard>\"},`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` {\"name\": \"order\", \"pattern\": \"ORD-[0-9]{8}\"}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"dropAttributes\": [\"customer.address\"]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`EOF`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`printf`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Card 4111 1111 1111 1111, mail bob@example.com, order ORD-12345678\\\\n'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` magpie-server`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` mask-test`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --mask`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` mask.json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` 2>`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /dev/null`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Card \u003ccard>, mail [EMAIL], order [ORDER]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`mask-test`}),` tries a policy on a text and stores nothing. Then start the server with it:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`magpie-server`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --dir`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ./masked`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --mask`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` mask.json`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$REPO`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`/scripts/send-trace.sh\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --url`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` http://127.0.0.1:4318`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --text`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"My mail is bob@example.com\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /dev/null`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`sleep`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -s`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` localhost:4318/v1/count`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{\"filter\": {\"text\": {\"phrase\": \"bob example com\"}}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`echo`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -s`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` localhost:4318/v1/count`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{\"filter\": {\"text\": {\"words\": \"EMAIL\"}}}'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`echo`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -s`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` localhost:4318/v1/mask`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`{\"count\":0}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`{\"count\":2}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`{\"droppedAttributes\":0,\"enabled\":true,\"rules\":[{\"masked\":2,\"name\":\"email\"},{\"masked\":0,\"name\":\"secret\"},{\"masked\":0,\"name\":\"credit_card\"},{\"masked\":0,\"name\":\"order\"}]}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`send-trace.sh`}),` puts the text into two spans (the agent run and the model call): two matches of `,_jsx(_components.code,{children:`email`}),`, and the address is found by no search.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Built-in rules: `,_jsx(_components.code,{children:`email`}),`, `,_jsx(_components.code,{children:`credit_card`}),` (with the Luhn check), `,_jsx(_components.code,{children:`ipv4`}),`, `,_jsx(_components.code,{children:`phone`}),` (only numbers that start with `,_jsx(_components.code,{children:`+`}),`), `,_jsx(_components.code,{children:`secret`}),` (key shapes such as `,_jsx(_components.code,{children:`sk-...`}),`, AWS key ids, GitHub and Slack tokens, JWTs, `,_jsx(_components.code,{children:`Bearer ...`}),`, PEM keys). Each is narrow on purpose. None finds names of people. A `,_jsx(_components.code,{children:`pattern`}),` is a regex of the Rust `,_jsx(_components.code,{children:`regex`}),` crate.`]}),`\n`,_jsx(_components.li,{children:`A wrong policy stops the start, with the name of the rule. A write never fails because of the policy.`}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`GET /v1/mask`}),` gives counts only. It gives no value.`]}),`\n`,_jsxs(_components.li,{children:[`What each rule does not find, and the other limits: `,_jsx(_components.a,{href:`/reference/server`,children:`Server reference, “Masking”`}),`.`]}),`\n`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Masked: `,_jsx(_components.code,{children:`input`}),`, `,_jsx(_components.code,{children:`output`}),`, `,_jsx(_components.code,{children:`error`}),`, every text value in `,_jsx(_components.code,{children:`attributes`}),` and `,_jsx(_components.code,{children:`events`}),`, and the `,_jsx(_components.code,{children:`label`}),` and `,_jsx(_components.code,{children:`comment`}),` of a score. `,_jsx(_components.strong,{children:`Not masked:`}),` ids (also `,_jsx(_components.code,{children:`userId`}),` and `,_jsx(_components.code,{children:`sessionId`}),`), `,_jsx(_components.code,{children:`name`}),`, `,_jsx(_components.code,{children:`kind`}),`, `,_jsx(_components.code,{children:`model`}),`, `,_jsx(_components.code,{children:`service`}),`, `,_jsx(_components.code,{children:`environment`}),`, `,_jsx(_components.code,{children:`tags`}),`, attribute keys, numbers. Do not put private data there.`]})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`A new policy changes new writes only. For old data, use the `,_jsx(_components.a,{href:`/operations/data-lifecycle#deletes-for-privacy-and-purge`,children:`deletes`}),`.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Masking private data","sidebarTitle":"Masking","description":"Replace private data in every span and score before it is stored, with --mask.","href":"/operations/masking"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"subdomain":"magpie-f30b9567","siteName":"Magpie","title":"Masking private data - Magpie","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-12-06T05:43:40.395Z","originalFileLocation":"operations/masking.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Replace private data in every span and score before it is stored, with --mask.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Magpie\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Masking private data - Magpie\">\u003cmeta data-mint-head property=\"og:description\" content=\"Replace private data in every span and score before it is stored, with --mask.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Magpie\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://magpie-f30b9567.mintlify.app/operations/masking\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://magpie-f30b9567.mintlify.site/_mintlify/api/og/v2?division=Run+in+production\u0026amp;title=Masking+private+data\u0026amp;description=Replace+private+data+in+every+span+and+score+before+it+is+stored%2C+with+--mask.\u0026amp;theme=c12fb36a245ba8a0a1e4be77\u0026amp;signature=9ae7d806bce4ee7dd08f3dbab315fe1eb6726713dcd6bc028760ff2ddef86ca5\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Masking private data - Magpie\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Replace private data in every span and score before it is stored, with --mask.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://magpie-f30b9567.mintlify.site/_mintlify/api/og/v2?division=Run+in+production\u0026amp;title=Masking+private+data\u0026amp;description=Replace+private+data+in+every+span+and+score+before+it+is+stored%2C+with+--mask.\u0026amp;theme=c12fb36a245ba8a0a1e4be77\u0026amp;signature=9ae7d806bce4ee7dd08f3dbab315fe1eb6726713dcd6bc028760ff2ddef86ca5\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/magpie-f30b9567/1JOp6MR2aIDJOeid/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Magpie\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#8A5A00\">\u003clink data-mint-head rel=\"canonical\" href=\"https://magpie-f30b9567.mintlify.app/operations/masking\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/operations/masking.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://magpie-f30b9567.mintlify.app/#organization\",\"name\":\"Magpie\",\"url\":\"https://magpie-f30b9567.mintlify.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/magpie-f30b9567/lfS8S2tPtzbDfpXA/logo/light.svg?fit=max\u0026auto=format\u0026n=lfS8S2tPtzbDfpXA\u0026q=85\u0026s=6974f4dc1ead619990c46e61fa4c1569\"}},{\"@type\":\"WebSite\",\"@id\":\"https://magpie-f30b9567.mintlify.app#website\",\"name\":\"Magpie\",\"url\":\"https://magpie-f30b9567.mintlify.app\",\"publisher\":{\"@id\":\"https://magpie-f30b9567.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/masking#webpage\",\"url\":\"https://magpie-f30b9567.mintlify.app/operations/masking\",\"name\":\"Masking private data\",\"description\":\"Replace private data in every span and score before it is stored, with --mask.\",\"dateModified\":\"2026-12-06T05:43:40.395Z\",\"isPartOf\":{\"@id\":\"https://magpie-f30b9567.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/masking#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/masking#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Run in production\",\"item\":\"https://magpie-f30b9567.mintlify.app/operations/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Masking private data\",\"item\":\"https://magpie-f30b9567.mintlify.app/operations/masking\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/masking#article\",\"headline\":\"Masking private data\",\"name\":\"Masking private data\",\"description\":\"Replace private data in every span and score before it is stored, with --mask.\",\"url\":\"https://magpie-f30b9567.mintlify.app/operations/masking\",\"mainEntityOfPage\":{\"@id\":\"https://magpie-f30b9567.mintlify.app/operations/masking#webpage\"},\"dateModified\":\"2026-12-06T05:43:40.395Z\",\"publisher\":{\"@id\":\"https://magpie-f30b9567.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://magpie-f30b9567.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Magpie\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Magpie\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/operations/masking.md","siteName":"Magpie","nav":{"global":null,"groups":[{"group":"Get started","pages":[{"title":"Magpie","sidebarTitle":"Introduction","icon":"feather","href":"/index"},{"title":"Quickstart","sidebarTitle":"Quickstart","href":"/quickstart"},{"title":"Set up Magpie with a coding agent","sidebarTitle":"Agent setup","icon":"terminal","href":"/agent-setup"},{"title":"Library or server?","icon":"signs-post","href":"/library-or-server"},{"title":"Use these docs with AI tools","icon":"robot","href":"/ai-tools"}]},{"group":"Send traces","pages":[{"title":"Send traces with OpenTelemetry","sidebarTitle":"OpenTelemetry","href":"/guides/opentelemetry"}]},{"group":"Libraries","pages":[{"title":"Rust library","sidebarTitle":"Rust","href":"/libraries/rust"},{"title":"Node.js library","sidebarTitle":"Node.js","href":"/libraries/node"},{"title":"Python library","sidebarTitle":"Python","href":"/libraries/python"}]},{"group":"Queries","pages":[{"title":"Queries","href":"/queries/overview"},{"title":"Find text","href":"/queries/text-search"},{"title":"Filter spans","href":"/queries/filters"},{"title":"Questions about whole traces","href":"/queries/traces"},{"title":"Add up numbers","href":"/queries/sums"},{"title":"Sessions and scores","href":"/queries/sessions-scores"},{"title":"Read and export","href":"/queries/read-export"},{"title":"The same queries in the library","href":"/queries/library"}]},{"group":"Run in production","pages":[{"title":"Run Magpie for a company","sidebarTitle":"Overview","href":"/operations/overview"},{"title":"API keys and TLS","href":"/operations/keys-tls"},{"title":"Tenants: one store per customer","sidebarTitle":"Tenants","href":"/operations/tenants"},{"title":"Retention and deletes","description":"Drop old spans with --retention. Delete a person's data and purge it from the disk.","href":"/operations/data-lifecycle"},{"title":"Masking private data","sidebarTitle":"Masking","href":"/operations/masking"},{"title":"Import and backup","description":"Load traces from files with magpie-server import, and back up and restore a store.","href":"/operations/backup-import"},{"title":"S3","href":"/operations/s3"},{"title":"Durability and upgrades","href":"/operations/durability-upgrades"},{"title":"Errors, memory and threads","href":"/operations/errors-memory"},{"title":"Security","href":"/security"},{"title":"Limits","href":"/limits"}]},{"group":"Server reference","pages":[{"title":"magpie-server","href":"/reference/server"},{"title":"HTTP API","href":"/reference/http-api"},{"title":"Tenants, API keys and TLS","href":"/reference/tenants-and-keys"},{"title":"S3 with the server","href":"/reference/server-s3"},{"title":"Viewer","href":"/reference/viewer"},{"title":"Import old traces","href":"/reference/import"},{"title":"Mapping, cost and masking","href":"/reference/mapping-cost-masking"}]},{"group":"Benchmarks","pages":[{"title":"Benchmarks","icon":"chart-simple","href":"/benchmarks"}]}]},"basePath":"","title":"Masking private data - Magpie","deploymentId":"dpl_HZVV42MMRSo9WnNHfTGZvby5jph9","buildId":"dpl_HZVV42MMRSo9WnNHfTGZvby5jph9","dynamics":[],"chunks":[]}