Created
August 22, 2013 11:11
-
-
Save perbu/6305927 to your computer and use it in GitHub Desktop.
Quick and dirty way to split varnish log stream into separate file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use IO::File; | |
while($logline = <>) { | |
($n) = $logline =~ m/\s+(\d+)/; | |
unless ($F{$n}) { | |
print "New FD: $n\n"; | |
$F{$n} = IO::File->new("$n.log", "w") | |
}; | |
$F{$n}->print($logline); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment