GoLog
=====
A simple self contained web server process that logs data from incoming HTTP request.
Dependencies:
Redis Server
MaxMind C development library libgeoip-dev
Go Redis Client (github.com/fzzy/radix - v0.3.4)
Go GeoIP Client (github.com/abh/geoip - at least from commit 6fd87ec2cc or newer)
MaxMind GeoIP Legacy DBs (http://geolite.maxmind.com/download/geoip/database/)
Usage:
go run golog.go -i [IP] -p [PORT] -b [BUFF_LINES] -db [REDIS_DB_INDEX] -d [LOGFILES_DIRECTORY] -domain [DOMAIN]
or with compiled binary:
./golog -i [IP] -p [PORT] -b [BUFF_LINES] -db [REDIS_DB_INDEX] -d [LOGFILES_DIRECTORY] -domain [DOMAIN]
Parameter details:
-version
: Simply prints the current version and exits
-i
: The IP to start the logging server on (default = 0.0.0.0)
-p
: The port on which to listen (default = 80)
-b
: The number of lines to store in the buffer before writing to disk (default = 25)
-db
: The index number of the redis DB to use (default = 2)
-flushredis
: Setting value to 1 will flush the selected redis DB on startup (default = 0)
-d
: The directory in which the logfiles are to be stored (default = /var/log/golog/)
-domain
: The domain for which to set the UDID cookie on
-stats
: Option that specifies if the server will report stats via HTTP (default = 0)
-ri
: The IP on which the reporting server will listen
-rp
: The port on which the reporting server will listen
-conf
: The config file to use to start up the process, instead of specifying all params via command line
HTTP Tracking URL Format:
----------------------
Place this url in a tracking pixel somewhere at the bottom of your HTML code
http://[DOMAIN]:[PORT]?cid=[CID]&category=[CATEGORY]&action=[ACTION]&label=[LABEL]&value=[VALUE]&rnd=[RAND_INT]
[DOMAIN]
-> The domain of the website collecting the stats
[PORT]
-> The port on which the tracking server is listening
[CID]
-> The Client ID of the user account. (Arbitrary identifier decided by tracking server owner, same concept as a Google Analytics tracking code)
[CATEGORY]
-> Based on same concept as the Google event tracking parameters (https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#SettingUpEventTracking)
[ACTION]
-> ** View explanation for [CATEGORY]
**
[LABEL]
-> ** View explanation for [CATEGORY]
**
[VALUE]
-> A numeric value to give this tracking request, typically 1
[RAND_INT]
-> A random integer (suggested between 1 and at least 1000000) that prevents this HTTP request from being cached
HTTP Stats Monitoring:
----------------------
http://[BASE_DOMAIN]:[STATS_PORT]/stats
-> Returns a JSON encoded object containing cumulative stats showing the number of visits from each continent and country broken down by hour of the day
http://[BASE_DOMAIN]:[STATS_PORT]/statsdevices
-> Returns JSON encoded object containing cumulative stats regarding user agents, such OS, OS version, user agent type, rendering engine, etc.
http://[BASE_DOMAIN]:[STATS_PORT]/statsvisitors?domain=[DOMAIN]
-> Returns JSON encoded object containing the pages currently visited for the specified domain
http://[BASE_DOMAIN]:[STATS_PORT]/statsgeovisitors?continent_code=[CONTENT_CODE]&country_code=[COUNTRY_CODE]
-> Returns JSON encoded object containing the approximate geo-coordinates of each visitor in the current day
Stats Monitoring Parameter Details:
-----------------------------------
[DOMAIN]
-> The domain name for which to filter the stats
[CONTINENT_CODE]
-> The two letter code of the continent, or the wildcard () for all continents
[COUNTRY_CODE]
-> The two letter code of the country, or the wildcard () for all coutries
** Please note that specifying * for the CONTINENT_CODE will also directly result in a wildcard for the COUNTRY_CODE