Graham --

[EMAIL PROTECTED] wrote:
> 
> Well, having asked the question about how to do reverse  DNS lookup,
> here's a simple ( non generalised script ) that does this for my web
> server log.
> 
> Improvements gratefully accepted.

OK, here's one...

You original script won't work if you have password-protected areas in
your website, because then the second " - " in the "find" statement is
the login userid instead of a -. If all the users of a subsite of your
website have to log in with the same userid (say... eeyore), and if you
only want to analyze visits to that subsite, then you can modify the
script as follows. Pulling out only the desired lines also makes it run
considerably faster if you have very large access logs.

You can also put "print now" statements at the beginning and end of the
guts of the script, if you care to know how long the processing took.

> 
> Rebol [
>     Title:  "web log resolver"
>     File:   %logresolve.r
>     Author: "Graham Chiu"
>     Email:  [EMAIL PROTECTED]
>     Date:   [ 17-Jan-2000 ]
>     Rights: "GNU"
      Editor: "Marj Tiefert"
     Version: 0.2
>     Purpose: { converts a web server log in standard/extended format so
> that IP addresses are changed 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 " - eeyore "
    if remainder [
>         domain: select dns-cache url
>         if ( domain == none ) [
>                 domain: read join dns:// url
>                 if ( domain == none ) [
>                         domain: "unknown"
>                 ]
>                 append dns-cache url
>                 append dns-cache domain
>         ]
>         append newlog join domain [ remainder newline ]
>         prin "."
      ]
> ]
> 
> write/lines %new.log newlog
> 
> 
> -------

Now can somebody answer my previous posting?  :-(   ;-)  :-)

cheers,

Marj
-- 
Marj Tiefert, [EMAIL PROTECTED]               phone: +858-799-5580
Principal Scientific Writer and Documentation Website Manager
Molecular Simulations Inc                 http://www.msi.com/

Reply via email to