Rene Christensen Dokbua
2013-Jul-08 07:52 UTC
[Icecast] script to link error.log and access.log for the purpose of finding the name of a disconnected feed
My humble contribution to the project. :) #!/usr/bin/perl -w open my $EL, "/var/log/icecast/error.log" || die; $| = 1; while(my $buf = <$EL>) { if ($buf =~ /Disconnect/) { $_ = $buf; s/\[|\]//g; my @tmp = split(/ +/); my $time = $tmp[1]; open my $AL, "/var/log/icecast/access.log" || die; my @lines = grep { /$time/ && /SOURCE/ } <$AL>; close($AL); print @lines; } } close($EL); -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/icecast/attachments/20130708/57b941db/attachment.htm
Xabier Oneca -- xOneca
2013-Jul-08 09:53 UTC
[Icecast] script to link error.log and access.log for the purpose of finding the name of a disconnected feed
A source (and clients too) doesn't appear in access.log until it has disconnected, so you can bypass the error.log file filtering. I usually use the following command line for the same task: $ grep SOURCE /var/log/access.log -- Xabier Oneca_,,_ El 08/07/2013 11:19, "Rene Christensen Dokbua" <rene at dokbua.com> escribi?:> > My humble contribution to the project. :) > > #!/usr/bin/perl -w > > open my $EL, "/var/log/icecast/error.log" || die; > > $| = 1; > > while(my $buf = <$EL>) { > if ($buf =~ /Disconnect/) { > $_ = $buf; > s/\[|\]//g; > my @tmp = split(/ +/); > my $time = $tmp[1]; > open my $AL, "/var/log/icecast/access.log" || die; > my @lines = grep { /$time/ && /SOURCE/ } <$AL>; > close($AL); > print @lines; > } > } > > close($EL); > > > > _______________________________________________ > Icecast mailing list > Icecast at xiph.org > http://lists.xiph.org/mailman/listinfo/icecast > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/icecast/attachments/20130708/1af21732/attachment.htm