<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: privacy code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 26 Jul 2008 18:27:19 GMT</pubDate>
    <description>DZone Snippets: privacy code</description>
    <item>
      <title>Apache log anonymizer</title>
      <link>http://snippets.dzone.com/posts/show/1899</link>
      <description>&lt;code&gt;&lt;br /&gt;/**&lt;br /&gt;* Takes Apache log file at $log_path, hashes the client address, and &lt;br /&gt;* writes the file to $output_path. Useful for sharing log files without &lt;br /&gt;* compromising user privacy. Reads input line-by-line to handle very &lt;br /&gt;* large logs.&lt;br /&gt;*&lt;br /&gt;* @version 1.0&lt;br /&gt;* @author Scott Reynen&lt;br /&gt;* @copyright Scott Reynen 2006&lt;br /&gt;* @link http://httpd.apache.org/docs/1.3/logs.html#accesslog&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;$log_path = '';&lt;br /&gt;$output_path = '';&lt;br /&gt;&lt;br /&gt;$file = fopen( $log_path , 'r' );&lt;br /&gt;$output = fopen( $output_path , 'a' );&lt;br /&gt;&lt;br /&gt;while ( ! feof( $file ) ) &lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;	$line = fgets( $file , 8192 );&lt;br /&gt;	$space = strpos( $line , ' ' );&lt;br /&gt;	$out_line = md5( substr( $line , 0 , $space ) );&lt;br /&gt;	$out_line.= substr( $line , $space );&lt;br /&gt;	fwrite( $output , $out_line );&lt;br /&gt;&lt;br /&gt;} // while&lt;br /&gt;&lt;br /&gt;fclose( $file );&lt;br /&gt;fclose( $output );&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 11 Apr 2006 23:15:48 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1899</guid>
      <author>scottreynen (Scott Reynen)</author>
    </item>
  </channel>
</rss>
