Révision e5260be4
dovecot plugin check log file type by name
If dovecot plugin found dovecot-only log it will analyze it without filtering by 'dovecot' tag
| plugins/dovecot/dovecot | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
($dirname = $0) =~ s/[^\/]+$//; |
| 23 | 23 |
|
| 24 |
$dovelogfile = 0 ; |
|
| 25 |
|
|
| 24 | 26 |
$logfile = $ENV{'LOGFILE'} || '/var/log/mail.log';
|
| 25 | 27 |
|
| 28 |
if ( $logfile =~ /dovecot/ ) {
|
|
| 29 |
$dovelogfile = 1 ; |
|
| 30 |
} |
|
| 31 |
|
|
| 26 | 32 |
# Use an overrided $PATH for all external programs if needed |
| 27 | 33 |
$DOVEADM = "doveadm"; |
| 28 | 34 |
|
| ... | ... | |
| 171 | 177 |
$pos = $startsize; |
| 172 | 178 |
} |
| 173 | 179 |
|
| 180 |
print "# Logfile: $logfile\n"; |
|
| 181 |
print "# Pos: $pos\n"; |
|
| 182 |
print "# Startsize: $startsize\n"; |
|
| 183 |
|
|
| 174 | 184 |
if ($startsize < $pos) {
|
| 175 | 185 |
# Log rotated |
| 176 | 186 |
parseDovecotfile ($rotlogfile, $pos, (stat $rotlogfile)[7]); |
| ... | ... | |
| 208 | 218 |
my $line =<logf>; |
| 209 | 219 |
chomp ($line); |
| 210 | 220 |
|
| 211 |
if ($line !~ m/dovecot/) { next; }
|
|
| 212 |
|
|
| 213 |
if ($line =~ m/Aborted/) {
|
|
| 214 |
$aborted++; |
|
| 215 |
|
|
| 216 |
} elsif ($line =~ m/Login:/) {
|
|
| 217 |
$login++; |
|
| 218 |
|
|
| 219 |
if ( $line =~ m/TLS/) {
|
|
| 220 |
$tls++; |
|
| 221 |
} elsif ($line =~ m/SSL/) {
|
|
| 222 |
$ssl++; |
|
| 223 |
} |
|
| 224 |
|
|
| 225 |
if ( $line =~ m/pop3-login:/) {
|
|
| 226 |
$pop3login++; |
|
| 227 |
} elsif ($line =~ m/imap-login:/) {
|
|
| 228 |
$imaplogin++; |
|
| 229 |
} |
|
| 221 |
if ( $dovelogfile == 0 and $line !~ m/dovecot/) { next; }
|
|
| 222 |
else {
|
|
| 223 |
if ($line =~ m/Aborted/) {
|
|
| 224 |
$aborted++; |
|
| 225 |
|
|
| 226 |
} elsif ($line =~ m/Login:/) {
|
|
| 227 |
$login++; |
|
| 228 |
|
|
| 229 |
if ( $line =~ m/TLS/) {
|
|
| 230 |
$tls++; |
|
| 231 |
} elsif ($line =~ m/SSL/) {
|
|
| 232 |
$ssl++; |
|
| 233 |
} |
|
| 234 |
|
|
| 235 |
if ( $line =~ m/pop3-login:/) {
|
|
| 236 |
$pop3login++; |
|
| 237 |
} elsif ($line =~ m/imap-login:/) {
|
|
| 238 |
$imaplogin++; |
|
| 239 |
} |
|
| 240 |
} |
|
| 230 | 241 |
} |
| 231 | 242 |
} |
| 232 | 243 |
close(logf); |
Formats disponibles : Unified diff