logstop-php

Keep personal data out of your logs

MIT License

Downloads
1
Stars
4
Committers
1

Logstop PHP

🔥 Keep personal data out of your logs

$logger->info('Hi [email protected]!');
# Hi [FILTERED]!

By default, scrubs:

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

Works with context as well

$logger->info('Hi', ['email' => '[email protected]']);
# Hi {"email":"[FILTERED]"}

Works even when sensitive data is URL-encoded with plus encoding

Installation

Run:

composer require ankane/logstop

And add it to your Monolog logger:

$logger->pushProcessor(new Logstop\Processor());

Options

To scrub IP addresses (IPv4), use:

new Logstop\Processor(ip: true);

To scrub MAC addresses, use:

new Logstop\Processor(mac: true);

Disable default rules with:

new Logstop\Processor(
    email: false,
    phone: false,
    creditCard: false,
    ssn: false,
    urlPassword: 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-php.git
cd logstop-php
composer install
composer test
Package Rankings
Top 41.69% on Packagist.org
Badges
Extracted from project README
Build Status
Related Projects