I have https_acces_log log files being generated by Apache that a certain web app is logging unwanted data into the file. I can't stop the app from logging the data, so I'd like to write a perl/python script which will take the data output by Apache and run a regex on it to replace the data in real time.
Assuming Perl is the right tool, here's where I'm at so far. Script produces no output right now. Help anyone?
$|=1; # Use unbuffered output
while (<STDIN>) # Loop through STDIN
{
$Msg = $_; # Capture the line of input
if ($Msg =~ m/&passwd=\w+GET/ ) # Look for the string I don't want
{
$Msg =~ s/&passwd=\w+GET/&password=XXXXXXGET/g;
print $Msg; # Print it
}
else
{
print $Msg\n;
}
}