[Zope] Zserver logs
Graham Chiu
anon_emouse@hotmail.com
Tue, 18 Jan 2000 10:44:07 +1200
In article <042a01bf6091$affc3890$0100a8c0@rochester.rr.com>, Darrell
<dgallion@rochester.rr.com> writes
>> Is it possible to configure Zserver to produce logs with domains rather
>> than just IP addresses?
>
>Not a Zserver patch but a fun util if you like.
>Parses a file for IP addresses and replaces them with the IP and host names.
>This would be much faster with threads.
>
>>python hosts.py access-log
Hi Darrell,
I tried this out but all I got was just lots of scrolling text. I don't
read python so guess I invoked it incorrectly.
However, I managed to cobble together a script in Rebol
( www.rebol.com ) that does what I needed. It should work on any of the
umpteen platforms that Rebol supports.
Rebol [
Title: "web log resolver"
File: %logresolve.r
Author: "Graham Chiu"
Email: gchiu@compkarori.co.nz
Date: [ 17-Jan-2000 ]
Rights: "GNU"
Version: 0.1
Purpose: { changes a web server log in standard/extended format so
that IP addresses are resolved to domain names. }
]
dns-cache: make block! 1000
newlog: make string! 10000
weblog: read/lines %z2.log
foreach line weblog [
url: first parse line none
remainder: find line " - - "
domain: select dns-cache url
if ( domain == none ) [
domain: read join dns:// url
if ( domain == none ) [
domain: "unresolved"
]
append dns-cache url
append dns-cache domain
]
append newlog join domain [ remainder newline ]
prin "."
]
write/lines %new.log newlog
-------
Regards, Graham Chiu
gchiu<at>compkarori.co.nz
http://www.compkarori.com/dynamo - The Homebuilt Dynamo
http://www.compkarori.com/dbase - The dBase bulletin