####IP based geolocation for Apache access log
Copyright (C) 2013 Gael Abadin
License: MIT Expat
A marvelous piece of software you can roll on your apache web server in order to get some geographical info about your site's visitors on a super cool map, chart and table. Check it all out working in this demo.
A serious web traffic analytics or maps rendering tool.
If you know all about KPIs, mapnik, geoJSON, PostGIS geometries, etc. you are probably wasting your time here: This is just an amusement, not precisely a proper web analytics tool with an embedded GIS, but if you find it useful and miss any features I'm open to suggestions.
So, that's it.
- Client-side input validation.
- REST-alike clean URLs.
- Masked IPs option.
- Optimized access log parsing.
- HTTPBasicAuth support.
- A lot of refactoring.
- Optimized database queries.
- Error message handling.
- Fake
access_log
file generator (for testing purposes and show off).
(I wanted to see how this app would perform on huge access_log files, but didn't have any, so I ended up overkilling the issue by designing the nastiest, most awesome access_log
generator the world will ever ignore, using discrete event statistical modeling theory, forked processes and shared memory with signaling and semaphores and all kinds of freaky stuff. Check its code for more info ;-))
- Super cool zoomable timeline chart with granularity modulation (visits per minute, hour, day or month).
I have not the time or the patience to test this code thoroughly so, as Doctor Knuth would say, "I have only proven it correct". Since my skills are nowhere near Doctor Knuth's, beware of the many bugs and help me clean the code by reporting them (I'll fix anything reported ASAP.)
- Read comments at the beginning of setup.php file.
- After deployment, hit deployment location.
- Filters on the map markers and chart data points.
- Gettext translations.
- Support for different access_log formats.
- .htaccess tweaks.
- Websockets based real time option (v0.5).
- Snippety thingy for selective logging (v0.6).
- Wordpress/Drupal plugin.
- Android client.
Everybody behind this thick fraking stack that makes the awesome possible.
- Fork me on github
git checkout -b newbranch
andgit push origin newbranch
your commits- Make a pull request from your branch
AND/OR
- Buy me a beer! ( Paypal or Bitcoin: 15QjBzCVckAwtLK5v95M8GS2tbpnTwKm5B )
Q: I can't access the app on the specified location when setup finishes.
A: You probably have a conflict with an existing .htaccess on your server. Add these two lines at the top of all your previously existent .htaccess files on the path to the one generated by setup.php, right after RewriteEngine on
line:
RewriteCond %{REQUEST_URI} ^/uri/path/to/geogoogael/parent/folder(/.*)?$
RewriteRule (.*) $1 [L]
(of course you need to replace the path with the real path to the app's deployment folder from the webroot)
Q: Does it work on windows?
A: No. You should be able to patch it and have it working in about 5 minutes, though. This is because I don't like or care about WAMP very much. (Sorry)
Q: It is working, but why so darn slow?
A: Maybe you are not caching database queries? Try enabling cache on you my.cnf mysql/mariadb server config file and setting cache size to at least 16MB. On big log files some requests can still take more than a minute at first, probably due to the log file not being cached on the RAM yet.
Q: Why did you go all this way instead of just using google analytics?
A: There may be a better explanation in the foreseeable future, but mainly because I could do it and felt like doing it.
Q: To be clear... Is there any advantage on using this over google analytics?
A: None that I can think of... Nope. None at all.
Q: Can I use this code commercially?
A: Yes, you can.
Specifically, this code and the libraries it uses (which you will find on geogoogael/lib folder) have GPLv2 compatible licenses that allow commercial use free of charge, with two notable exceptions: Google Maps API and highcharts plugin, both with available licensing options for commercial use which are not free of charge (check out the links for pricing). About the geolocation database, it is available for free for commercial use, as long as the terms stated here are met.
This product includes IP2Location LITE data available from http://www.ip2location.com
There you go. Have fun.