· sysadmin linux

Clean Passwords from Logs

Today was a day of fixing things. We had some issues with a bad behaving Storm topology so I wrote up some scripts to automate collecting the heap dump, generating a report, tailing relevant logs, and then shipping the whole thing off to a file server. Worked great until I realized the developers were keeping sensitive information in the topology config which is spewed into the log on every restart!

Enter sed. I needed to purge out any connection strings for our databases which I accomplished with the following commands:

sed -r 's/(vertica|secondarydb)\.([^"]+)" "?[^,]+/\1.\2" "*****"/g'

What it does:

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket