Skip to the content
Olbo

Guides

How to remove API keys and passwords from a log file before you share it

To remove API keys and passwords from a log file, cover each one in place and keep the rest of the line, so the log still makes sense to whoever reads it. Olbo's Redactor does this in your browser. It finds access keys, tokens, private keys, IP addresses and long passwords written after a word such as password=, along with emails and phone numbers, and saves a copy with each one swapped for a label such as [REDACTED_SECRET]. The log is not uploaded.

Open the Redactor

Step by step

  1. Open the Redactor and press Choose a file, or drag your log onto the window.A .log, .txt, .json, .yaml, .ini, .conf or .toml file opens, and so do .env files and HAR files saved from a browser. On the Free plan, files up to 2 MB open, so cut a long log down to the part you need first.
  2. Open Looking for 10 of 12 and check what is ticked.Secrets and IPs are ticked when the file opens, along with Emails, Phones and the rest. Tick Links as well to cover web addresses. A token in an address, such as ?token=, is covered either way, but the rest of that address stays, even with Links ticked. On a phone, that list is under More.
  3. Choose Full or Partial.Full, the default, swaps each value for a label such as [REDACTED_SECRET]. Partial keeps the first four characters of a key, as in AKIAxxxx, so whoever reads the log can tell what kind of key it was. On a phone, Full and Partial are under More.
  4. Read down the log for anything it missed.On a computer, press Ctrl+G, or Cmd+G on a Mac, to jump from one finding to the next. Click a covered value to put it back, or select text on a line with the mouse and press Redact to cover it.
  5. Press Download the copy.On a phone the button says Download. The copy is saved as a new file, such as app.redacted.log, with every line where it was.
  6. Press Start over when you have finished.Until you do, this browser keeps a copy of the log as you opened it, keys and all. Start over deletes it. On a phone, Start over is under More.

Which API keys and passwords it finds in a log

Keys with a shape of their own are covered wherever they appear: AWS access key IDs, GitHub and Slack tokens, Stripe live keys, Google API keys, JWTs and private key blocks. So is the password in a connection string such as postgres://app:hunter2@db, and so are IP addresses, private ones included, apart from 127.0.0.1 and 0.0.0.0. A version number written like an address, such as 1.2.3.4, is covered as one too.

Anything else is covered only when a word in front of it says it is a secret, such as password=, token: or api_key=, and the value is at least 16 characters long. A short password like password=hunter2, or a key after a word it does not know, such as APP_KEY or DB_PASS, stays as it is. So does an email address written as jane%40example.com, the way it appears inside a web address. Read the copy before you send it.

.env and HAR files

In a .env file a covered line keeps the part before the = sign, so DB_PASSWORD=[REDACTED_SECRET] still tells the reader which setting it was. If the file chooser will not let you pick a file such as .env.local, drag it onto the window instead.

A HAR file is still valid JSON after it is cleaned. The Authorization header and cookies called session or session_id are covered, but cookies called something else, such as JSESSIONID or PHPSESSID, are not, so check the cookies and any form data before you attach it. Leave Names unticked for a HAR file: ticked, it covers header names such as Authorization as if they were people.

If a key was already shared

Covering a key in this copy does nothing for a copy of it that is already out, in a ticket or a repository. Replace that key with a new one from the service that issued it.

More guides

Olbo is an office suite that runs in your browser. Your files are read on the machine you are sitting at and are never uploaded. See all the tools.