事实上,我想看到的人,从哪个域名访问我的网站。我想从Apache access.log文件中的IP地址生成域名。
我该怎么做?大约有54个日志文件。我把所有的文件连在一起。
这是Unix服务器。我必须使用apache日志文件分析器。所以我使用了webalizer,但是它并不是将IP解析为域名。
发布于 2013-09-04 10:01:09
如果使用Windows,可以使用脚本解析连接的日志文件,在每个IP上执行"nslookup“。
if wscript.arguments.count > 0
then
logname = wscript.arguments(0)
set fs = wscript.createobject("scripting.filesystemobject")
set readstream = fs.opentextfile(logname, 1, 0, 0)
while not readstream.atendofstream str = readstream.readline ' parse str with RegEx object to get IP
set shell = wscript.createobject("wscript.shell")
shell.run "nslookup " & ip & " > temp.txt", 0
set lookupstream = fs.opentextfile("temp.txt", 1, 0, 0)
lookup = lookupstream.readall ' parse lookup info
lookupstream.close
wend
readstream.closehttps://serverfault.com/questions/536190
复制相似问题