Skip to content

Instantly share code, notes, and snippets.

@levlaz
Last active August 3, 2021 02:41
Show Gist options
  • Save levlaz/5a64059bc57cf172a269dddce14c07e7 to your computer and use it in GitHub Desktop.
Save levlaz/5a64059bc57cf172a269dddce14c07e7 to your computer and use it in GitHub Desktop.
Nonsense logs with PII
logs:
- type: file
path: "tmp/sample_logger.log"
service: "nf"
"""Send Logs to DataDog.
This is a utility script that generates fake logs for filling in the DataDog log dashboard.
"""
import time
import logging
from faker import Faker
fake = Faker()
logging.basicConfig(filename='/tmp/sample_logger.log',
encoding='utf-8', level=logging.DEBUG)
log = logging.getLogger()
while True:
log.warning(fake.sentence())
log.warning(fake.sentence())
log.warning(fake.sentence())
log.warning(fake.sentence())
log.warning(fake.paragraph())
log.error(f"SSN:{fake.ssn()} and CC:{fake.credit_card_number()}")
log.warning(fake.sentence())
log.warning(fake.sentence())
log.warning(fake.sentence())
log.warning(fake.credit_card_number())
log.warning(fake.sentence())
time.sleep(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment