Skip to content

Instantly share code, notes, and snippets.

@perbu
Created August 22, 2013 11:11
Show Gist options
  • Save perbu/6305927 to your computer and use it in GitHub Desktop.
Save perbu/6305927 to your computer and use it in GitHub Desktop.
Quick and dirty way to split varnish log stream into separate file.
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