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.

Rebol [
    Title:  "web log resolver"
    File:   %logresolve.r
    Author: "Graham Chiu"
    Email:  [EMAIL PROTECTED]
    Date:   [ 17-Jan-2000 ]
    Rights: "GNU"
    Version: 0.1
    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 " - - "
        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

        
-------
Regards,        Graham Chiu
gchiu<at>compkarori.co.nz
http://www.compkarori.com/dynamo - The Homebuilt Dynamo
http://www.compkarori.com/dbase - The dBase bulletin

Reply via email to