Use schell script for anonymizing logs
authorvarac <varacanero@zeromail.org>
Tue, 21 Feb 2017 10:46:56 +0000 (11:46 +0100)
committervarac <varacanero@zeromail.org>
Tue, 21 Feb 2017 10:46:56 +0000 (11:46 +0100)
clean-log.sh [moved from clean-log.sed with 53% similarity, mode: 0755]

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"