maptail

maptail的原理是基于node.js, 通过调用WEB服务器访问日志实时打印访问信息.
注:下面node是基于源码编译安装.并依赖python2.6~2.7版本,如果python是2.6以上版本无需再安装.
软件包下载地址:
maptail:https://github.com/stagas/maptail/
node:http://nodejs.org

一、安装node

#wget http://nodejs.org/dist/v0.10.0/node-v0.10.0.tar.gz#tar zxvf node-v0.10.0.tar.gz#cd node-v0.10.0#./configure#make && make install

二、安装maptail

解压出来就可以了,无需编译安装.

#wget https://github.com/stagas/maptail/archive/master.zip#unzip master.zip#mv maptail-master /usr/local/maptail

三、安装其它依赖包

运行maptail报以下错误安装以下依赖包:
Error: Cannot find module 'geoip-lite-with-city-data'
Error: Cannot find module 'express'
Error: Cannot find module 'simpl'

#cd /usr/local/maptail/bin#npm install geoip-lite#npm install express#npm install simpl


修改maptail.js.

#cd /usr/local/maptail/lib#vi maptail.js


将geoip-lite-with-city-data改为geoip-lite

四、下载数据文件

#cd /usr/local/maptail/node_modules/geoip-lite/data#wget https://github.com/bluesmoon/node-geoip/blob/master/data/geoip-city-names.dat#wget https://github.com/bluesmoon/node-geoip/blob/master/data/geoip-city.dat

五、运行maptail

#cd /usr/local/maptail/bin#nohup tail -fn 20 /htdocs/logs/access.log | ./maptail -h 192.168.1.1 -p 8080 &


访问:http://192.168.1.1:8080
注:/htdocs/logs/access.log为站点访问日志文件.


你可能感兴趣的:(maptail)