channel_stats plugin for Apache Traffic Server 3.0.0+

About channel_stats plugin
==========================
channel_stats plugin collect the runtime statistics (speed, request count and
more in the future) for each channel. The stats is exposed with http interface
in json. (The code of interface is from 'stats_over_http' plugin.)

In general, the plugin could be used on reverse proxy with a fixed number of
remap rules. It's not design for the proxy which serves unlimited channels (
open-relay forward proxy).


Installation
==========================
  make -f Makefile.tsxs
  sudo make install -f Makefile.tsxs
(if 'tsxs' is not in your PATH, run make by appending TSXS=/path/to/ts/bin/tsxs)

Add 'channel_stats.so' to plugins.config. By default, the path of http interface
is '_cstats'. For safety, you should change it by adding a parameter after
'channel_stats.so'. Example: 'channel_stats.so _my_cstats'.

Restart Traffic Server: sudo traffic_line -L or sudo trafficserver restart


Viewing Stats
==========================
Visit http://local_IP:port/_cstats (or as you configured in plugin.config)
Output will be in json:

{
  "channel": {
    "www.example.com": {
      "response.bytes.content": "3486995502046",
      "response.count.2xx.get": "64040675",
      "speed.ua.bytes_per_sec_64k": "3972287"
    },
    "www.test.com": {
      "response.bytes.content": "3349404916760",
      "response.count.2xx.get": "64038172",
      "speed.ua.bytes_per_sec_64k": "3989255"
    }
  },
 "global": {
    "response.count.2xx.get": "268516715",
    "server": "3.0.4"
  }
}

Available stats:
 - response.bytes.content: transferred content length (not including header)
 - response.count.2xx.get: transaction count
 - speed.ua.bytes_per_sec_64k: count of transaction whose speed is < 64KBps

Additional parameters:
 - topn: only output top N channels order by response count
 - channel: only output the channels which contain specific string
 - global: also display TS internal stats as 'stats_over_http' plugin
 Example:
 - http://127.0.0.1/_cstats?global
 - http://127.0.0.1/_cstats?topn=5
 - http://127.0.0.1/_cstats?channel=test.com
 - http://127.0.0.1/_cstats?channel=test.com&topn=5&global
If you have a large number of channels (e.g. more than 10k), those parameters 
may not be heavily used due to extra overhead.


Warning
==========================
Security
 - As mentioned above, you should change default path of http interface to make
   other people harder to access your channel stats.
 - For IPv4, plugin will make sure visitor is from private network.
   (http://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces)
   In addition, you should deny the request to http interface on your L7 front-
   end because your L7 server and TS are probably in a same local network. And 
   currently plugin doesn't check IPv6 address. (should disable IPv6 by default?)
 - The number of channels is limited to 100000.


DEV
==========================


ChangeLog
==========================

Version 0.1 (11/26/12)
  - Initial release
