[REBOL] Re: [UPDATE] web.log data mining
From: ryan:christiansen:intellisol at: 20-Mar-2001 14:14
>> Below is an updated version of the CLF format web.log
>> file data mining
>> script, which parses CLF format web.log files and places
>> the data in .csv
>> files for use in Excel and other applications. The script
>> now calls
>> functions instead of being simply linear.
>Have you thought about saving the dns-cache between
>iterations, and loading it each time?
>I was going to do that for mine, but never got around to it.
Yes, the first time the script runs, it loads a 0-byte cache file called
%dns-library.r, as such...
retrieved-library: read %dns-library.r
dns-library: parse retrieved-library none
It then uses the following function for the DNS lookups...
dns-lookup: func [
"Convert an IP address to a domain name"
dns-cache "A cache of IP addresses and corresponding domain names"
IP [string!] "The IP address that needs to be converted to a domain"
/local domain
][
domain: select dns-cache IP
if ( domain == none ) [
domain: read join dns:// IP
if ( domain == none ) [
domain: "unresolved"
]
append/only dns-cache IP
append/only dns-cache domain
]
domain
]
At the end of the script, it saves the dns cache back to the %dns-library.r
file, as such...
write %dns-library.r ""
foreach library-entry dns-library [
write/append %dns-library.r library-entry
write/append %dns-library.r " "
]