繁體中文 |
简体中文 |
English
reslog.pl v2.0.1
WHAT'S NEW?
reslog.pl v2.0.1 is released. You could click
here
to download.
DESCRIPTION
reslog.pl reverse-resolves IPs in the apache
log files. These log files can then be analyzed by another program,
like analog. You can treat it as a replacement of apache
HostNameLookups directive, which resolves the client IPs
altogether at a later time.
CAUTION
-
Resolving takes long time. This is mainly caused by
resolving, but not the resolver program itself. To avoid
simultaneously writing to the log file while resolving, which might
ruin the log file, it tries its best. It uses flock() to
prevent simultaneously writing from other programs (or another
instance of itself) that utilize flock(). In order to
prevent from those that do not utilize flock(), like
httpd, it copies the records to a temporary working file
first to maximum reduces the time occupying the log file.
-
If it stops in the half of execution, as when the user hits a
ctrl-break, it might leave a temporary working file. The
next time it sees a previous temporary working file, it will refuse to
run. Please process that file first. You can rename and treat it like
another log file. It can then be resolved again.
-
This prorgam needs temporary working space. After comparing between
memory and disk space, I choose disk space because it is relatively
cheaper and more economic. However, this means that it needs free
temporary disk space about 2 times of the size of the source log file
(10 times if using memory). Please be sure you have that much free
space.
SYSTEM REQUIREMENT
-
Perl, version 5.005 or above. This program uses the File::Temp module,
which requires some new features introduced from perl 5.005.
Perl is distributed with most Unix now. If not, or if you have an
older version of perl, you could download and install/upgrade it from
http://www.perl.com/.
If you are using MS-Win32, you can download and install from
http://www.activestate.com/.
-
Required perl modules:
File::Spec::Functions,
File::Temp,
Compress::Zlib.
You can always search, download and install the missing perl modules
from the the CPAN archieve:
http://search.cpan.org/.
DOWNLOAD
You could always download the newest version of reslog.pl from the
following addresses:
INSTALL
-
Extract the downloaded tar ball
% tar -xzf reslog.pl-x.xx.xx.tar.gz
-
Install using the installation script (recommended)
Although this program does not need configurations, it is still
recommended that you run the installation script. It will check
anything this program needs and warn you in advance if something is
missing.
You'll have to install File::Spec::Functions first in order to run
the installation script. It is included in the perl distributions
from v5.6.0. If you are using an older version of perl without it,
you could download and install it from the CPAN archive:
http://search.cpan.org/.
Goto the extracted directory, run the Install.PL
% ./Install.PL
It will check everything it needs and prompt you necessary settings.
Answer them according to your needs. Then it will install the program
according to your answers. You could also try
% ./Install.PL --help
for a list of available command line options.
-
Manual set up and install
Copy the reslog.pl to your favorite directory. Make sure it is
executable.
% chmod +x reslog.pl
That's all.
-
Run
Run it and see if anything wrong. You could try
% ./reslog.pl --help
for a list of available command line options. Try
% perldoc reslog.pl
for a complete document of this program.
OPTIONS
./reslog.pl [options] [logfile...]
./reslog.pl [-h|-v]
- logfile
-
The log file to be resolved. If not specified, it will read from
STDIN and output to STDOUT. You could also
specify "-" to read from STDIN.
Multiple log files are supported. If one of these files are
STDIN, it will output to STDOUT. Gzipped
files are supported, too.
- -s, --suffix=suf
-
The suffix of the output resolved file. The default suffix is
.resolved.
- -o, --override[=mode]
-
Whether we should overwrite the existing resolved files. Currently
the following modes are supported:
- o, overwrite
-
Overwrite any existing target file. If --override was
specified without mode, it assumes that you want to
overwrite.
- a, append
-
Append the records to the existing target files.
- f, fail
-
Stop processing whenever a target file exists, to prevent destroying
any existing files by accident. This is the default.
- -k, --keep[=mode]
-
What to keep in the original file. Current available modes are:
- a, all
-
Keep the source file after records are archived. If
--keep was specified without mode, it
assumes that you want to keep all.
- r, restart
-
Restart the source file after records are resolved.
- d, delete
-
Delete the source file after records are resolved. This is the
default.
- -c, --stdout
-
Output the result to STDOUT.
- -d, --debug
-
Show the detailed debugging messages.
- -q, --quiet
-
Shihhhhhh. Only yell when errors.
- -h, --help
-
Display the help message and exit.
- -v, --version
-
Output version information and exit.
COPYRIGHT
Copyright © 2001 imacat. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
RELEASE NOTES
Please read the RELEASE_NOTES for the new functions and bug fixes.
by imacat <imacat@mail.imacat.idv.tw>, first version 2001-07-04, last updated 2001-09-01

This page conforms with HTML 4.01 / CSS2 recommendations