Skip to content
This repository

Heroku log router

branch: rebarization

This branch is 0 commits ahead and 1232 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 include
Octocat-spinner-32 release
Octocat-spinner-32 src
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .gitmodules Removing git submodules in favour of rebar deps. January 10, 2012
Octocat-spinner-32 Makefile
Octocat-spinner-32 Procfile
Octocat-spinner-32 README.md
Octocat-spinner-32 rebar
Octocat-spinner-32 rebar.config
README.md

Setup

$ bin/get-deps development
$ make

Erlang version

Tested on Erlang R13B04

EUnit tests

prereq: start a local redis server on the default port 6379

$ bin/test

Run

Development

$ bin/console

Production

*note: assumes Ubuntu/Upstart for start/stop commands

$ [start|stop|restart] logplex
$ bin/connect ('ctrl-g q' to exit)

REST API

Healthcheck

GET /healthcheck

Channels

POST /channels

JSON Params:

  • name: channel name (required)
  • app_id: Heroku app_id (required)
  • addon: Heroku addon [basic|expanded|advanced] (required)

Resp:

  • status: 201
  • body: channel_id


POST /channels/<channel_id>/token

JSON Params:

  • name: token name that will appear as the log msg source (required)

Resp:

  • status: 201
  • body token_id


POST /channels/<channel_id>/addon

JSON Params:

Resp:

  • status: 200
  • body: OK


GET /channels/<channel_id>/info

Resp:

  • status: 200
  • body: json info object

    DELETE /channels/

Resp:

  • status: 200
  • body: OK

Sessions

POST /sessions

JSON Params:

  • channel_id (required)
  • tail (optional)
  • num (optional)
  • source (optional)
  • ps (optional)

Resp:

  • status: 201
  • body: session_id


GET /sessions/<session_id>

Resp:

  • status: 200
  • body: log data

Drains

POST /channels/<channel_id>/drains

JSON Params:

  • host (required)
  • port (optional)

Resp:

  • status: 201


GET /channels/<channel_id>/drains

Resp:

  • status: 200
  • body: drain list


DELETE /channels/<channel_id>/drains

Querystring Params:

  • host (required)
  • port (required)

Resp:

  • status: 200

Environment Variables

  • LOGPLEX_COOKIE - Erlang cookie, important for multiple node grid (not required)
  • LOGPLEX_CONFIG_REDIS_URL - config data redis url (default: redis://127.0.0.1:6379)
  • HTTP_PORT - http port (default: 80)
  • LOGPLEX_AUTH_KEY - api http header 'Authorization' == LOGPLEX_AUTH_KEY (required)
  • LOCAL_IP - ip to register with other logplex nodes (default: 127.0.0.1)
  • LOGPLEX_WORKERS - number of workers pulling from queue (default: 10)
  • LOGPLEX_DRAIN_WRITERS - number of writers pulling from buffer and writing to drains (default: 100)
  • LOGPLEX_REDIS_WRITERS - number of writers pulling from buffer and writing to redis (default: 100)
  • LOGPLEX_READERS - number of readers pulling from read queue (default: 100)
  • LOGPLEX_QUEUE_LENGTH - max length of read queue (default: 2000)
  • LOGPLEX_DRAIN_BUFFER_LENGTH - max length of drain write buffer (default: 2000)
  • LOGPLEX_REDIS_BUFFER_LENGTH - max length of redis write buffer (default: 2000)
  • LOGPLEX_READ_QUEUE_LENGTH - max length of read queue (default: 2000)

Sharding

Add new log redis url to config redis shard key:

sadd redis:shard:urls redis://password@hostname:6379/

Redis Keys

ch:336:data (hash)
drain:57:data (hash)
tok:t.abcdefghijklmnopqrstuvwxyz:data (hash)
ch:17:spool (list)
/sessions/09743165504ecc6c4db21cbb0083c030 (string)
drain_index (counter)
channel_index (counter)
healthcheck (counter)
node:heroku.com:10.100.0.1 (string)
redis:shard:urls (set)

License

Copyright (c) 2010 Jacob Vorreuter jacob.vorreuter@gmail.com

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.