Keep secrets and personal data out of your logs
See what Tailcove masks before a line is stored, add your own field names, and redact emails, IP addresses or a whole field with a transform rule.
Before you start
- A Tailcove source receiving logs
- A client package at 0.2.0 or later for client-side masking
- An owner or admin role on the team to change rules
Sooner or later someone logs a whole request body, and a password ends up in your log search. Tailcove masks the obvious secrets twice: once in the client, before a line leaves your app, and once on the server, before the line is stored. This guide shows what that covers, what it leaves alone on purpose, and how to take out the rest.
On this page6 sections
1. Know what's masked before a line leaves your app#
Since 0.2.0, the Laravel, Node.js, Python, browser, React Native and Flutter clients mask secrets before a line is queued, so they never cross the network. It's on by default and needs no setup. Masking works on a copy: your own objects aren't changed.
It does three things:
- A context field whose name says it holds a secret, such as
password,db_password,apiKey,x-api-key,client_secret,Authorizationorcookies, has its whole value replaced with[redacted], nested objects included.null,trueandfalsestay, sohas_password: truestill reads fine. - In the message and every other string, the value after a secret name becomes
[redacted]:password=hunter2,?token=abc123,"api_key": "...",Authorization: Bearer .... - Credentials you can tell by their shape become
[key]wherever they appear: JWTs, AWS access key ids, Stripe secret keys, GitHub, Slack and Google API tokens, and private key blocks.
So a line like this:
POST /login password=hunter2
goes out as:
POST /login password=[redacted]
Names that only look similar, like max_tokens, token_count or password_changed_at, aren't touched. A colon in
plain prose doesn't count either, so password: too short stays as written.
[!NOTE] If masking ever fails on a line, the line is sent as
[redacted: masking failed]with no context. It's never sent unmasked.
Here's the split between what's covered for you and what's your call:
| Kind of data | Masked by default | What to do |
|---|---|---|
| Passwords, tokens, API keys, cookies in named fields | Yes, in the client and on the server | Nothing |
| JWTs, AWS, Stripe, GitHub, Slack and Google keys, private key blocks | Yes, in the client and on the server | Nothing |
| Card numbers, and Bearer or Basic credentials outside a named field | Yes, on the server (recommended masking) | Check it's on (step 2) |
Your own sensitive fields (customer_ssn, iban) |
No | Add the names (step 3) |
| Email addresses | No | Add a redact rule (step 4) |
| IP addresses | No | Add a redact rule (step 4) |
2. Turn on recommended masking for the source#
The server does the same job again with recommended masking: secret fields, API keys and tokens, bearer and Basic credentials and card numbers are masked before your own rules run. It catches lines from clients older than 0.2.0, from shippers like Vector or Fluent Bit, and from anything that sends straight to the HTTP API.
Every source created on or after 29 November 2026 has it on. Older sources have it off until you turn it on.
To check, open the source's Settings. If masking is off, the Transform rules card says so and has a Turn on masking button. On the transform rules page, a source without it shows "Secrets in this source's logs are stored as sent" and a Turn on recommended masking button. With it on, you'll see a Recommended masking card with the presets it runs and a switch.
A few things to know before you press it:
- Only team owners and admins can change it, and the audit log records who did.
- It changes lines that arrive after you switch it on. Lines already stored stay as they are.
- It doesn't count toward your plan's rule limit.
[!WARNING] You can switch recommended masking off on the same page. Only do that if you mask everything yourself before it reaches Tailcove.
3. Add your own field names#
The built-in names cover credentials. Your app has its own sensitive fields, and the client can't guess them. Add them
as extra secret names and their whole value becomes [redacted], just like password.
Names are compared whole, ignoring case, -, _, . and spaces, so customer_ssn also covers customerSsn and
Customer-SSN.
TAILCOVE_SECRET_KEYS=customer_ssn,iban
const tailcove = new Tailcove({
token: process.env.TAILCOVE_TOKEN,
secretKeys: ['customer_ssn', 'iban'],
});
handler = TailcoveHandler(
token=os.environ["TAILCOVE_TOKEN"],
secret_keys=["customer_ssn", "iban"],
)
init({
key: '<your browser key>',
secretKeys: ['customer_ssn', 'iban'],
});
In Laravel you can also set secret_keys on a single channel in config/logging.php. With pino, secretKeys goes in
the transport options.
[!NOTE] These names live in the client. They aren't sent to the server, so a line from another app or shipper on the same source won't get them. For that, use a redact rule on a field (step 4).
4. Redact emails, IP addresses or a field with a transform rule#
Emails and IP addresses aren't in recommended masking, because they're often exactly what you search for when a customer writes in. If you'd rather not store them, add a rule.
Open the source's Settings, then Edit transform rules. Under Add a rule, choose Redact. Email addresses is ticked to start; tick anything else to take out:
- Email addresses become
[email]. - IP addresses become
[ip], both IPv4 and IPv6.

Where sets the scope: Message, host and context, Message only or Context only. Leave Only for lines matching
empty to run the rule on every line, or narrow it with the query language, such as
path:/api*. Regular expressions aren't allowed in rules.
With both presets ticked, this line:
Invite sent to [email protected] from 203.0.113.7
is stored as:
Invite sent to [email] from [ip]
To blank one field whatever it holds, fill in Replace a whole field with its name: message, host, or a context
field like user.email. Its value becomes [redacted].
[!TIP] Once an email is redacted, you can't search for it. If support looks people up by email, consider redacting only on the paths that don't need it, or redacting a field like
request.bodyinstead of every email.
Redact rules count toward your plan's rules per source (3 on Free, 15 on Pro, 50 on Business), the same as drop and sample rules from Cut your log bill.
5. Test the rule with the preview before you save#
Press Preview on the last 50 lines. It runs your rules, recommended masking included, against the source's most recent lines and shows each one before and after. Nothing is saved or changed.
Each line gets a badge: changed or unchanged, or drop or sample for a line a drop or percentage rule would take out. Look for a line you know holds an email
and check it now reads [email]. If a rule fails on a line, the badge says how many rules were skipped; a failing rule
never drops the line.
When it looks right, press Save rules. Redaction happens before a line is stored, shown in live tail, counted in an issue or exported, so nothing downstream sees what the rule took out. Lines that were already waiting when you saved are cleaned with the rules that were current when they arrived, and lines already stored aren't rewritten.
6. Change or drop lines in code with beforeSend#
For anything a rule can't express, every client has a hook. It runs after masking, on each line about to be queued.
Return the line, changed or not, to send it, or null (None in Python) to drop it.
// AppServiceProvider::boot()
use Tailcove\Laravel\Tailcove;
Tailcove::beforeSend(function (array $entry): ?array {
unset($entry['context']['customer_email']);
return $entry;
});
const tailcove = new Tailcove({
token: process.env.TAILCOVE_TOKEN,
beforeSend: (line) => {
const { customer_email, ...context } = line.context;
return { ...line, context };
},
});
def before_send(entry):
entry["context"].pop("customer_email", None)
return entry
handler = TailcoveHandler(
token=os.environ["TAILCOVE_TOKEN"],
before_send=before_send,
)
init({
key: '<your browser key>',
beforeSend(line) {
if (line.message.includes('ResizeObserver loop')) {
return null;
}
return line;
},
});
Only null drops a line. If the hook throws, the error goes to the client's own error handler and the masked line is
sent as it was, so a bug in your hook can't lose logs.
Laravel registers the hook in code rather than config because closures can't live in a cached config file.
Tailcove::beforeSend(null) removes it. With pino, beforeSend isn't available: pino runs the transport in a worker
thread and a function can't be passed to it.
[!WARNING] In Laravel, slow-query lines leave out their
bindingsunlessTAILCOVE_SLOW_QUERY_BINDINGSis on. Bindings are the real values in a query, often emails and password hashes with no key name next to them, so masking can't catch all of them. Leave it off in production.
The client pages have every option: Laravel, Node.js, Python and browser. The full rule reference is in Transform rules.
Ready to try it on your own logs?
The Free plan includes a source, live tail, search and alerts. No credit card.