Logplex Client

command line interface

What follows are examples.

# You must do this.
$ export LOGPLEX_URL=https://heroku:[email protected]

$ bin/logplex channels:create channel-blah
creating channel... done
channel id: 3858972

$ logplex channels:get 3858972
getting channel (3858972)... done

id: 3858972
no tokens
no drains

$ logplex channels:delete 3858972
deleting channel... done

$ logplex tokens:create 3858972 helloworld
creating token...
helloworld => t.7c55b81f-59b3-45bb-87b1-aefc0fd96a40

$ bin/logplex channels:get 3858972
getting channel (3858972)...done

id: 3858972
token: helloworld (t.7c55b81f-59b3-45bb-87b1-aefc0fd96a40)
no drains

$ bin/logplex channels:logs 3858972 --ps web.1
2012-03-22T00:12:47+00:00 app[web.1]: foo
2012-03-22T00:12:48+00:00 app[web.1]: bar

Ruby Usage

ruby api/usage docs

You can view the rubydoc for this project by running:

$ bundle install
$ make showdocs

Then point your browser at http://localhost:8808/ to view the HTML version of the API docs.

Managing Logplex

# Get a new client.
=> client = Logplex::Client.new("https://heroku:[email protected]")

# Create a named channel.
=> channel = client.create_channel("channel-blah")

# Get a known channel by id
=> channel = client.channel(1001)

# Destroy a channel
=> channel.destroy

# Create a named token on a channel
=> token = channel.create_token("app")

# Destroy a token
=> token.destroy

# Create a drain
=> drain = channel.create_drain

# Get a known drain by a drain id
=> drain = channel.drain(12345)

# Make the drain point at a specific syslog receiver:
=> drain.url = "syslog://example.com:1234/

# Destroy a drain
=> drain.destroy

Writing to Logplex

# Get an Emitter for writing logs using a token
=> emitter = token.emitter

# Writing an event
# Note, you must be running on the heroku platform for this to work as
# currently the port used by log transport into logplex is firewalled.
=> emitter.emit("processname", "message")

Reading from Logplex

# Create a log session (for reading logs)
=> session = channel.session(:num => 10)
# or tail things
=> session = channel.session(:num => 10, :tail => true

# Read logs from a session
=> session.each_event do |event|
     puts event
   end

Logplex HTTP API

https://logplex.herokuapp.com/

Testing

export LOGPLEX_URL=https:u:[email protected] 
rspec spec