Use schell script for anonymizing logs
[scripts.git] / clean-log.sh
1 #!/bin/sh
2
3 # Use this sed script to clean your logs before
4 # pasting it publicly
5
6 # Usage:
7 #   Replace `your_username` and `your_domain` in this script, then:
8 #
9 #     ./clean-log.sh LOGFILE
10
11 # Todo:
12 #  - IPs (should be already cleaned by rsyslog)
13 #  - Browser user agents
14 #  - Generate this script from leap_cli
15
16
17 sed -r '
18 # Clean all email addresses
19 s/((\w|[.])+)@((\w|[.])+)/<EMAIL REDACTED>/g
20
21 # Replace username
22 s/your_username/<USERNAME_REDACTED>/g
23
24 #Replace domain
25 s/your_domain/<DOMAIN_REDACTED>/g
26 ' "$1"