Skip to content
/ logplex Public

Publish and Consume Logplex messages

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.txt
Notifications You must be signed in to change notification settings

hgmnz/logplex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logplex

Publish and Consume Logplex messages

Logplex is the Heroku log router, and can be found here.

Publishing messages

publisher = Logplex::Publisher.new(logplex_url)
publisher.publish("There's a lady who's sure, all that glitters is gold",
                   process: 'worker.2', host: 'some-host')

Passing an array of messages to the #publish method will publish them all in one request, so some latency optimization is possible:

publisher.publish [ "And as we wind on down the road",
                    "Our shadows taller than our soul",
                    "There walks a lady we all know",
                    "Who shines white light and wants to show"]

The message can also be passed in the form of a Hash, in which case it is formatted as machine readble key/value pairs suitable for metrics collection, eg: log2viz

publisher.publish { vocals: 'Robert Plant', guitar: 'Jimmy Page' }
# produces the message: vocals='Robert Plant' guitar='Jimmy Page'

Consuming messages

TBD

Configuration

You can configure default values for logplex message posting:

Logplex.configure do |config|
  config.logplex_url     = 'https://logplex.example.com/logs'
  config.process         = 'stats'
  config.host            = 'host'
  config.publish_timeout = 2
end

In the example above, it is now not not necessary to specify a logplex URL, process or host when getting a hold of a publisher and publishing messages:

publisher = Logplex::Publisher.new
publisher.publish "And she's buying a stairway to heaven"

License

Copyright (c) Harold Giménez. Released under the terms of the MIT License found in the LICENSE file.

About

Publish and Consume Logplex messages

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.txt

Stars

Watchers

Forks

Packages

No packages published

Languages