ankane / logstop.py

Keep personal data out of your logs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logstop.py

🔥 Keep personal data out of your logs

logger.info('Hi test@example.org!')
# Hi **********!

By default, scrubs:

  • email addresses
  • phone numbers
  • credit card numbers
  • Social Security numbers (SSNs)
  • passwords in URLs

Works even when data is URL-encoded with plus encoding

Build Status

Installation

Run:

pip install logstop

And add it to your logger:

from logstop import LogstopFilter

logger.addFilter(LogstopFilter())

Options

To scrub IP addresses (IPv4), use:

LogstopFilter(ip=True)

To scrub MAC addresses, use:

LogstopFilter(mac=True)

Disable default rules with:

LogstopFilter(
    email=False,
    phone=False,
    credit_card=False,
    ssn=False,
    url_password=False
)

Notes

  • To scrub existing log files, check out scrubadub
  • To scan for unencrypted personal data in your database, check out pdscan

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/ankane/logstop.py.git
cd logstop.py
pip install -r requirements.txt
pytest

About

Keep personal data out of your logs

License:MIT License


Languages

Language:Python 97.2%Language:Makefile 2.8%