Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/apache/apache_vhosts/apache_logparser | ||
|---|---|---|
| 95 | 95 |
#find sitename |
| 96 | 96 |
$file=~s/$site/$1/; |
| 97 | 97 |
$file=$vhost if $vhost; |
| 98 |
|
|
| 98 |
|
|
| 99 | 99 |
# skip broken lines |
| 100 | 100 |
next unless $file; |
| 101 | 101 |
|
| ... | ... | |
| 103 | 103 |
my $vpm=clean_fieldname("$file");
|
| 104 | 104 |
$temp{$vpm}{'label'}="$file";
|
| 105 | 105 |
$temp{$vpm}{'label'}=~s/www\.//;
|
| 106 |
|
|
| 106 |
|
|
| 107 | 107 |
# count all requests |
| 108 | 108 |
$temp{$vpm}{'requests'}++;
|
| 109 | 109 |
|
| ... | ... | |
| 118 | 118 |
# average bytes |
| 119 | 119 |
$temp{$vpm}{'avg_bytes'}=$temp{$vpm}{'bytes'}/$temp{$vpm}{'requests'} || 0;
|
| 120 | 120 |
} |
| 121 |
|
|
| 121 |
|
|
| 122 | 122 |
# count by status / error code |
| 123 | 123 |
$temp{$vpm}{"status"}{$status}++ if $status;
|
| 124 | 124 |
|
| 125 | 125 |
if ($time) {
|
| 126 | 126 |
# microsec to millisec |
| 127 |
$time=sprintf("%d",$time/1000);
|
|
| 127 |
$time=sprintf("%d",$time/1000);
|
|
| 128 | 128 |
|
| 129 | 129 |
# min/max execution time |
| 130 | 130 |
$temp{$vpm}{'max_time'}=max($temp{$vpm}{'max_time'},$time) || 0;
|
| ... | ... | |
| 144 | 144 |
# tail files, calls &count with linearray |
| 145 | 145 |
$tail->read; |
| 146 | 146 |
|
| 147 |
# begin transaction
|
|
| 147 |
# begin transaction |
|
| 148 | 148 |
$share->lock(LOCK_EX); |
| 149 |
|
|
| 149 |
|
|
| 150 | 150 |
# get data (may be updated by other loggers too) |
| 151 | 151 |
my %old=eval{%{thaw($share->fetch)}}; # using eval to suppress thaw error on empty string at the first run
|
| 152 | 152 |
|
| ... | ... | |
| 182 | 182 |
$share->store( freeze \%old ); |
| 183 | 183 |
# end transaction |
| 184 | 184 |
$share->unlock; |
| 185 |
|
|
| 185 |
|
|
| 186 | 186 |
# parse/write every n seconds (plus processing time) |
| 187 | 187 |
sleep $nsec; |
| 188 | 188 |
} |
Formats disponibles : Unified diff