|
Lines 68-73
Link Here
|
| 68 |
## log entry. It is slower, but it permits us to check for symlinks, and |
68 |
## log entry. It is slower, but it permits us to check for symlinks, and |
| 69 |
## flush the buffers so everything is realtime and we don't lose any entry. |
69 |
## flush the buffers so everything is realtime and we don't lose any entry. |
| 70 |
|
70 |
|
|
|
71 |
## Modified by Philipp Gaschuetz <pg@corpex.de>, replaced the usage of |
| 72 |
## `date +%Y-%m` with strftime - any system, which has the date command |
| 73 |
## would probably also have strftime support |
| 71 |
# |
74 |
# |
| 72 |
# This script will take a combined Web server access |
75 |
# This script will take a combined Web server access |
| 73 |
# log file and break its contents into separate files. |
76 |
# log file and break its contents into separate files. |
|
Lines 80-85
Link Here
|
| 80 |
# will be appended to any existing log files. |
83 |
# will be appended to any existing log files. |
| 81 |
# |
84 |
# |
| 82 |
|
85 |
|
|
|
86 |
use POSIX qw(strftime); |
| 87 |
|
| 83 |
while (<STDIN>) { |
88 |
while (<STDIN>) { |
| 84 |
# |
89 |
# |
| 85 |
# Get the first token from the log record; it's the |
90 |
# Get the first token from the log record; it's the |
|
Lines 99-107
Link Here
|
| 99 |
s/VLOG=(.*)[\/]*$//; |
104 |
s/VLOG=(.*)[\/]*$//; |
| 100 |
$logs=$1; |
105 |
$logs=$1; |
| 101 |
if($logs eq "") {$logs="/var/log/apache2";} |
106 |
if($logs eq "") {$logs="/var/log/apache2";} |
| 102 |
$date=`date +%Y-%m`; |
107 |
$date=strftime("%Y-%m", localtime()); |
| 103 |
chop $date; |
108 |
$filename="${logs}/VLOG-${date}-${vhost}.log"; |
| 104 |
$filename="$logs/VLOG-$date-${vhost}.log"; |
|
|
| 105 |
if (-l $filename) { |
109 |
if (-l $filename) { |
| 106 |
die "File $filename is a symlink, writing too dangerous, dying!\n"; |
110 |
die "File $filename is a symlink, writing too dangerous, dying!\n"; |
| 107 |
} |
111 |
} |