How To Make Log Files Anonymous? Beside Find&replace Manually!


BeTheSync

Recommended Posts

Hi,

 

I'd like to send some logfiles, but they contain sensitive names of folders and files which I don't want to, and may not disclose to anybody outside my company.

 

Is there somewhere a tool which "anonymize" a (btsync) logfile?

 

Say, since, the lines of a log start by a similar pattern when telling something about a special file/folder, the tool could just replace each files/folder by non-sensitive names, so developers don't loose the reference to other lines of the log, but cannot read/guess the original names.

 

It would take ages for a human to search & replace all those files / folders (maybe server names too) by hand, so I've looked around, but didn't find any suitable.

 

any Ideas/links?

 

thank you.

 

 

 

Link to comment
Share on other sites

BeTheSync,
 
In Mac's Terminal run command: 
 
perl -pi -w -e 's/text1/text2/g;' <file>
 
text1 = text you want to replace
text2 = text you want to replace with! 
<file> path/to/the/file/filename
 

For example: perl -pi -w -e 's/tracker/awesome/g;' ~/Documents/sync.log

Link to comment
Share on other sites

First thank you for your thoughts and your time,

but isn't this exactly the same as opening the saved log with a texteditor and doing a Search&Replace by hand?

 

My Perl coding isn't the best, but your script-documentation is quite fine :-)

 

So, when I have a logfile over 5 MB with, say, 500 different files/folders, will this little script help me in any way better than search&replace those 500 different files/folders by hand?

 

I was looking (hoping!) for somewhat like an automated script which "remembers" file/foldernames which it already has replaced, so that if it finds the same file/foldername again while doing its work, it just replaces the new occurence with the old replacement.

 

this way the developer, which looks at the anonymized log, can identify the different scenarios/lines at the log, where a file/folder has problems.

 

If I would replace every single file/folder with a new replacement, nobody would know that the same file is mentioned in logfile line 515 and line 2626 and line 263632.

 

so this is the reason, why I don't find time to anonymize my logfiles by hand.

because I want to send you the whole logfile, not just a snippet, where the important entries may be removed by me.

 

Any ideas welcomed!

 

Maybe we need to create a tool like this? But I think my coding skills are not even good enough for the above example ;-/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.