ex_gecko v0.1.0 ExGecko.Adapter.Papertrail

Interacts with papertrail cli to get latest logs, so that we can send to geckobard

Papertrail adapter accepts following arguments:

  • search : Search terms eg. API Requests
  • time : Earliest time to search from eg. 2 hours ago

Under the hood, it runs papertrail command

papertrail -S "API Requests" --min-time '120 minutes ago'

Summary

Functions

A sample format of the json object is like this. Note the “message” section

Functions

build_args(opts)
decode_line(line)
load_events(opts)
process_data(data)

A sample format of the json object is like this. Note the “message” section

%{ “displayreceived_at” => “Aug 02 19:14:29”, “facility” => “Local3”, “generated_at” => “2016-08-02T19:14:29Z”, “hostname” => “brighterlink-api”, “id” => “697210962448814080”, “message” => “at=info method=GET path=”/api/companies?=1470165266333” host=api.brighterlink.io request_id=6c1499a0-7e13-47ce-9efb-aa0a8dc9d7ea fwd=”199.91.127.142” dyno=web.1 connect=0ms service=94ms status=200 bytes=3165 “, “program” => “heroku/router”, “received_at” => “2016-08-02T19:14:29Z”, “severity” => “Info”, “source_id” => 242534344, “source_ip” => “54.145.114.143”, “source_name” => “brighterlink-api” }

“message” is a string broken up in this way

at=info
method=GET
path="/api/companies?_=1470165266333"
host=api.brighterlink.io
request_id=6c1499a0-7e13-47ce-9efb-aa0a8dc9d7ea
fwd="199.91.127.142"
dyno=web.1
connect=0ms
service=94ms
status=200
bytes=3165"
valid?(data)