Skip to content

Instantly share code, notes, and snippets.

@nicholasf
Forked from ivanvanderbyl/Readme.markdown
Created August 4, 2012 03:56
Show Gist options
  • Save nicholasf/3254242 to your computer and use it in GitHub Desktop.
Save nicholasf/3254242 to your computer and use it in GitHub Desktop.
CrashLog payload structure

CrashLog notification API

CrashLog accepts notifications over HTTP/S to stdin.crashlog.io along with an api_key and payload

API Key

The API key is a 32 character secure random string found on the project configuration page within your CrashLog account.

It should be sent along with the payload as a standard HTTP param with the key auth_token

Notification endpoint

All notifications should be sent to stdin.crashlog.io/notify over either plain HTTP or HTTPS to port 443.

Notification payload

You can see the notification payload example below, but here are the basics:

The payload can contain multiple interfaces, of which only 2 are required:

  • notifier (required)
  • event (required)
  • backtrace
  • environment
  • context

Notification response

A successfully lodged exception will return a hash like:

"{"location_id": "<128bit UUID>"}

location_id can be used to generate a URL to link directly to the exception or fetch information about it from the CrashLog public API.

Generating URLs

The standard location for locating exceptions within the CrashLog UI is http://crashlog.io/locate/:location_id

This will either return 404 if the exception has not yet been loaded (< T+1 second) or 301 with a redirection to the actual error page.

Fetching API data

You can fetch a JSON representation of the exception using the public API endpoints and your API key (found under your account settings page)

GET https://crashlog.io/api/locate/:location_id

{
"payload" : {
// Interface: Notifier
"notifier" : {
"name": "crashlog-nodejs",
"version": "1.0.0"
},
// Interface: Event
"event" : {
"message" : "Some one line error description",
"class_name": "RuntimeError",
"created_at" : "2012-08-03T12:34:19+10:00"
}
// Interface: Backtrace
"backtrace" : [
{
// Required
"file": "somewhere.js",
"number": 14, // Line number
"method": "raiseTheRoof",
// Optional
"context_line": "source code for affected line",
"pre_context" : ["line -1 before affected line", "line -2 before affected line", "line ..."],
"post_context" : ["line +1 after affected line", "line ..."]
},
{
// Required
"file": "somewhere_else.js",
"number": 192, // Line number
"method": "setup",
// Optional
"context_line": "source code for affected line",
"pre_context" : ["line -1 before affected line", "line -2 before affected line", "line ..."],
"post_context" : ["line +1 after affected line", "line ..."]
}
],
// Interface: Environment
// Optional
//
// Any key value pairs you want to be able to view later on
//
// At the moment this is unstructured, this will likely change in the furure.
"environment": {
"project_root" : "/home/deploy/my_app/current",
"platform" : "Node.js 0.6.x",
"name": "production",
"system": {
"distribution": "Ubuntu 12.04 LTS"
},
"browser": {
"ident": "Usual browser tag"
},
"plugins": []
// TODO: Insert more attributes here
},
// Interface: Context
// Optional
// Any contextual information relating to the cause of this error
// This is typically a serialisation of the current user
//
// The attributes can be used to correlate errors
"context" : {
"hostname": "app01.myhostname.com",
"current_user": {
"id": 1,
"email": "ivan@crashlog.io"
},
"controller": {
"name": "usersController",
"action": "index"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment