#!/usr/bin/perl -w # From http://docs.indymedia.org/view/Sysadmin/ApacheLogsWithoutIPs # 10 April 2005 # Cleaned up -zak 2005-04-10 use strict; # check we're called with exactly one argument, our output file name if ( @ARGV != 1 ) {die "I need exactly one argument ";} my $out=$ARGV[0]; open (OUT,">> $out") or die "Failed to open $out for writing: $! \n"; # turn on buffer autoflush so tail -f error.log works # (rather than waiting till file handle is closed my $outf = select(OUT); $|=1; select($outf); # Strip IP's and replace with 0.0.0.0 while () { s/\[client.*\]/\[client 0.0.0.0\]/; print OUT; } close (OUT);