Use schell script for anonymizing logs
[scripts.git] / clean-log.sh
old mode 100644 (file)
new mode 100755 (executable)
similarity index 53%
rename from clean-log.sed
rename to clean-log.sh
index f1e6e26..17ca209
@@ -1,18 +1,26 @@
+#!/bin/sh
+
 # Use this sed script to clean your logs before
 # pasting it publicly
 
 # Usage:
-#   sed -r -f clean-log.sed LOGFILE
+#   Replace `your_username` and `your_domain` in this script, then:
+#
+#     ./clean-log.sh LOGFILE
 
 # Todo:
 #  - IPs (should be already cleaned by rsyslog)
 #  - Browser user agents
+#  - Generate this script from leap_cli
+
 
+sed -r '
 # Clean all email addresses
 s/((\w|[.])+)@((\w|[.])+)/<EMAIL REDACTED>/g
 
 # Replace username
-s/varac/<USERNAME_REDACTED>/g
+s/your_username/<USERNAME_REDACTED>/g
 
 #Replace domain
-s/wazokazi.is/<DOMAIN_REDACTED>/g
+s/your_domain/<DOMAIN_REDACTED>/g
+' "$1"