Platinum Partner

Apache Log Anonymizer


/**
* Takes Apache log file at $log_path, hashes the client address, and 
* writes the file to $output_path. Useful for sharing log files without 
* compromising user privacy. Reads input line-by-line to handle very 
* large logs.
*
* @version 1.0
* @author Scott Reynen
* @copyright Scott Reynen 2006
* @link http://httpd.apache.org/docs/1.3/logs.html#accesslog
*/

$log_path = '';
$output_path = '';

$file = fopen( $log_path , 'r' );
$output = fopen( $output_path , 'a' );

while ( ! feof( $file ) ) 
{

	$line = fgets( $file , 8192 );
	$space = strpos( $line , ' ' );
	$out_line = md5( substr( $line , 0 , $space ) );
	$out_line.= substr( $line , $space );
	fwrite( $output , $out_line );

} // while

fclose( $file );
fclose( $output );
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}