Git Product home page Git Product logo

maptail's Introduction

maptail

maptail is a realtime map view of GeoIP data. Attach it to your server to track visitors, tail a log, pipe to its stdin or use it as a library to build your own implementation. Just emit IP addresses to it from any source and you'll automagically get a cool map with yellow dots and stuff like that streamed in with websockets or whatever transport you'd like to use.

Installing

npm install maptail -g

Omit the -g to install as a module.

How to use

The command line tool:

$ maptail -f nohup.out

$ tail -f nohup.out | maptail -h my.host.com -p 3000

In your server:

var maptail = require('maptail')
var express = require('express')
var app = express.createServer()

app.use(maptail.track())
app.use('/map', maptail.static())

maptail.attach(app)

app.listen(8080, 'localhost')

Let me explain what these are doing here a bit. maptail.track() tracks visitors' IPs and emits them to maptail. maptail.static() is an express.static() middleware that points to our static data (maptail.html, css, etc.)

maptail.attach(app) attaches a simpl WebSocket server which makes it possible for our frontend app to easily subscribe to the GeoIP data events sent by maptail and display them on the map.

If for example you don't want to track visitors of the http server but instead you want to send IPs from another source, you can easily remove maptail.track() from the middleware and use maptail.emit('ip', ipAddress[, logMessage]) to feed our map. It will take care the rest for you.

Credits

This is based on mape's wargames.

geoip-lite by Philip Tellis.

Earlier versions used kuno's GeoIP module but since it now uses a C library, I couldn't use it.

MaxMind for their free to use GeoIP data.

Licence

maptail is MIT/X11. The rest of the components are of their respective licences.

maptail's People

Contributors

stagas avatar sumitjain01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maptail's Issues

Not working behind cloudflare

Hi,

So I am totally running into despair about this

Have tried everything I can to make it work with a domain in cloudflare (and subdomains for that matter) , but it just won't go.

I have no issues when I setup the host to the server ip and access with that ip on the node server port.

If I change this to anything else it won't work (even localhost)

Tried websockets as suggested and in nginx added proxy_pass to server ip and port but still no go.

Any help would be most appreciated

Also, if I point the domain directly to the ip without using nginx proxy pass I can connect to node server port and I see the map but no data shows up at all.

Thanks

error when reverse proxy

cat nginx.conf
server
{
listen 80;
server_name view.test.com;
root /usr/lib/nodejs/maptail/public;
index index.html;

          location / {
            proxy_pass        http://1.1.1.1:4000;
        }

   }

nodejs command
tail -f /data/logs/*.log|maptail -h 0.0.0.0 -p 4000

but it's error

Unexpected response code: 200 :1
Uncaught Error: Uncaught, unspecified 'error' event. simpl.js:86
EventEmitter.emit simpl.js:86
EventStack.emit simpl.js:327
client.onerror

Port should be parsed into Integer

When the port parameter is passed as an argument, nodejs reads it as an string. Then the websocket port calculation fails. "port + 111" becomes "8080111" instead of "8191"

Won't install via NPM

Express required by this isn't available in the NPM repos. Here's my error log, not that it's required:

$ npm install maptail
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info range geoip@>=0.3.1
npm info latest = [email protected] not supported by [email protected]
npm info range express@>=2.0.0
npm ERR! Error: No satisfying version found for 'express'@'>=2.0.0'
npm ERR! Valid install targets for express: "latest", "0.14.0", "0.14.1", "1.0.0beta", "1.0.0beta2", "1.0.0rc", "1.0.0rc2", "1.0.0rc3", "1.0.0rc4", "1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4", "1.0.5", "1.0.6", "1.0.7"
npm ERR!     at /usr/local/lib/node/.npm/npm/0.3.18/package/lib/install.js:143:29
npm ERR!     at /usr/local/lib/node/.npm/npm/0.3.18/package/lib/install.js:178:5
npm ERR!     at saved (/usr/local/lib/node/.npm/npm/0.3.18/package/lib/utils/registry/get.js:56:7)
npm ERR!     at cb (/usr/local/lib/node/.npm/npm/0.3.18/package/lib/utils/graceful-fs.js:31:9)
npm ERR! Report this *entire* log at <http://github.com/isaacs/npm/issues>
npm ERR! or email it to <[email protected]>
npm ERR! Just tweeting a tiny part of the error will not be helpful.
npm ERR! System Linux 2.6.27.4rootserver-20081028a
npm ERR! argv { remain: 
npm ERR! argv    [ 'maptail',
npm ERR! argv      'express@>=2.0.0',
npm ERR! argv      'geoip@>=0.3.1',
npm ERR! argv      'socket.io@>=0.6.0',
npm ERR! argv      'jade@>=0.10.4' ],
npm ERR! argv   cooked: [ 'install', 'maptail' ],
npm ERR! argv   original: [ 'install', 'maptail' ] }
npm not ok

dependency issue with geoip

after i installed maptail i was having issues with geoip.
upon checkin I realized that the original geoip api has been changed.
so i had to make few chagnes tot he maptail.js file

13 line cities = new.geoip.City(__dirname" /'GeoLitecity.dat');

216 line city = cities.lookupsync(ip);

maptailing riak logs

It would be pretty cool if we could maptail riak logs. The recent http://blog.nodejitsu.com/put-your-logs-anywhere-with-winston supports riak and I think there is a ruby logger for riak too. Also, mapping from multiple buckets, so logs could be kept separate.

I'm not sure how the realtime aspect would work. Riak has post-commit hooks. Or maptail could get new log entries (http calls) every second or so...

TypeError: Cannot call method 'isConfigurable' of undefined

I get the following error:

node.js:63
throw e;
^
TypeError: Cannot call method 'isConfigurable' of undefined
at Function.seal (native)
at Object. (/usr/local/lib/node/.npm/chaos/0.1.6-pre/package/chaos.js:40:10)
at new (/usr/local/lib/node/.npm/chaos/0.1.6-pre/package/chaos.js:87:20)
at /usr/local/lib/node/.npm/chaos/0.1.6-pre/package/chaos.js:64:40
at /usr/local/lib/node/.npm/helpful/0.0.3/package/lib/login.js:205:23
at Object. (/home/olalonde/dev/node/maptail/maptail.js:57:5)
at Module._compile (node.js:462:23)
at Module._loadScriptSync (node.js:469:10)
at Module.loadSync (node.js:338:12)
at Object.runMain (node.js:522:24)

Can I turn off the animation?

First off, this code rocks! Thanks for sharing. I would like to turn off the animation. I get to much traffic and the page looks jumbled. Is it possible to see just the last dot for each ip?

Cheers,

Theo

minor issue with error handling (s/log/console.log)

I was trying out your module. Really cool thanks.

I was running it with a logfile with simulated IP addresses, and the IP 41.194.35.91 exposed this minor typo. You mean console.log, no?

diff --git a/maptail.js b/maptail.js
index 4b1abad..3c03764 100755
--- a/maptail.js
+++ b/maptail.js
@@ -139,7 +139,7 @@ var world = {
broadcast(returnObj)
}
else {

  •  log('Failed update, ' + from.name + ' lacks coordinates.')
    
  •  console.log('Failed update, ' + from.name + ' lacks coordinates.')
    
    }
    }

no traffic passing through

hi i have used this command on a busy log file but i see no traffic passed on the maptail page

nohup maptail -f /var/log/nginx/access.log -h 127.0.0.1 -p 3000 > /dev/null 2>&1 &

its just showing the map with no hits

npm -v ; node -v
1.4.28
v0.10.35

no dots are visible on map

After running this command on terminal : $ maptail -f nohup.out
it shows only map but no dots are visible on map.

Filter

Hi ,

Whats the use of filter in this, its on the basis of ip address.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.