[MASOCH-L] Topsenders no maillog do postfix

Jorge Augusto Senger jorge at br10.com.br
Fri Mar 30 12:38:41 BRT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Não conhecia! Valeu =)

Antonio Carlos Pina escreveu:
> pflogsumm.pl
> 
> :-)
> 
> 
> Em 30/03/07, Jorge Augusto Senger <jorge at br10.com.br> escreveu:
> 
> Olá,
> 
> Fiz um pequeno e simples script em perl para identificar os top senders
> de um servidor de e-mail rodando postfix.
> Claro que não substitui outras ferramentas de estatísticas mais
> avançadas, como o awstats, mas achei legal compartilhar com todos:
> 
> #---- INICIO
> 
> #!/usr/bin/perl -w
> # Em logs com muitos registros, redirecione a saída
> # para um arquivo qualquer para melhor análise.
> 
> use strict;
> use warnings;
> 
> my $arqlog = '/var/log/maillog';
> open (LOG, $arqlog);
> my @linhas = <LOG>;
> chomp @linhas;
> close LOG;
> my $linha;
> my %top;
> foreach $linha (@linhas)
> {
>        next if ($linha !~ m/from=</);
>        my ($mes, $dia, $hora, $server, $mta, $id, $from, $size, $nrcpt,
> $queue) = split(/\ /, $linha);
>        $from =~ s/from//g;
>        $from =~ tr/\=\<\>\ \,\;//d;
>        next if ($from !~ m/\@/);
>        $top{$from}++;
> }
> print "\n";
> print "<<< TOP SENDERS >>>\n\n";
> my $chave;
> foreach $chave (sort {$top{$b} <=> $top{$a}} keys %top)
> {
>        print "$chave =\> $top{$chave}\n\n";
> }
> exit;
> 
> #---- FIM
> 
> 
__
masoch-l list
https://eng.registro.br/mailman/listinfo/masoch-l

> __
> masoch-l list
> https://eng.registro.br/mailman/listinfo/masoch-l

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFGDS8BiOnIWGbribERAhF8AKD1aRSAfOVClqOV6Oq7s7Ocrl+AagCeL1tH
Tl3DPqWDgICd+pSUHgh+WY8=
=eQj8
-----END PGP SIGNATURE-----


More information about the masoch-l mailing list