Integrate Spike with elmah.io
Send elmah.io errors, uptime checks and heartbeats to Spike so a new exception or failing endpoint alerts on-call, and closes when elmah.io resolves it.
elmah.io is error logging, uptime monitoring and heartbeats for .NET. Your application ships its exceptions there through one of elmah.io's logger packages, and the same account watches your endpoints and your scheduled jobs. All three end up in one place — elmah.io's log — and a rule on that log is what forwards them anywhere else.
Point a rule's Send a HTTP request action at a Spike integration URL and those messages become incidents: a new exception or a down endpoint pages your escalation policy, repeats land on the incident already open, and the Information message elmah.io logs when a check recovers resolves the incident by itself.
What Spike does with each message
Two fields in the body do all the work. event_type is a value you hardcode, one per rule, and it says which shape of message arrived:
event_type
The rule that sends it
What Spike does with the body
Uptime
elmah.io's built-in Uptime message filter
Identifies the incident by url, the monitored endpoint, together with event_type. The failure, every repeat of it and the recovery all carry the same ones
Heartbeat
A rule matching your heartbeat messages
Treated exactly like Uptime — url is the identity, so is unhealthy and is degraded are one incident
Error
A rule matching your application's errors
Matched by title instead. On an error message url is the request URL, which is different on every occurrence of one exception, so Spike ignores it
severity is elmah.io's own level, and it is what says whether a message is the problem starting or the problem ending:
severity
What Spike does
Fatal
Opens an incident and pages your escalation policy
Error
Opens an incident and pages your escalation policy
Warning
Opens an incident. A heartbeat's degraded is an open problem, not a recovery
Information
Auto-resolves the open uptime or heartbeat incident for the same url, and never opens one. Dropped when nothing is open. An error incident is never auto-resolved
Verbose
Dropped. Opens nothing and resolves nothing
Debug
Dropped. Opens nothing and resolves nothing
One uptime rule therefore covers both directions. elmah.io's Uptime message filter matches the failure and the recovery alike, and severity is the only field that differs between them — Error on the way down, Information on the way back up. There is nothing to switch on for auto-resolution and no second rule to write.
Incident identity
Identity is the endpoint for a check, and the exception itself for an error:
Uptime and heartbeat messages are keyed on
urlandevent_type.urlis the endpoint or job elmah.io is watching, identical on the failure, on every repeat and on the recovery, so a flapping check pages once and resolves itself. It also holds while elmah.io rewords the sentence — a heartbeat that goesdegradedand thenunhealthyis two sentences about one problem and lands on one incident.event_typekeeps a check apart from an error whose request URL happens to be the same address.Error messages are matched on the incident title, which is why the title Spike builds for an error is byte-for-byte identical on every occurrence (see below). The second time an exception is thrown it joins the incident already open instead of paging again. Errors have no recovery message, so an error incident closes when you resolve it or on its resolve timer.
Incident titles
The title is elmah.io's own sentence about the fault, which is what title holds: the exception's message for an error, and the check's sentence for an uptime or a heartbeat message.
Nothing is appended on an Uptime or a Heartbeat message, because elmah.io's sentence already names the endpoint:
On an Error message the sentence is an exception message, and "Object reference not set to an instance of an object" could have come from any application you run. So the exception type and then the application are appended, the application last so that a long message can never cut off the answer to "where":
Each is appended whenever the body sends it, and only when event_type is Error.
The whole sentence, cut only at 200 characters
title is used whole, with whitespace collapsed, never shortened to its first sentence: .NET's argument exceptions read Value cannot be null. (Parameter 'userId'), and the part after the first full stop is what tells two of them apart. Titles are capped at 200 characters: over that, the exception type is dropped first, then the sentence is cut back to a word boundary, and on {application} is always kept whole.
When title is empty, the title is the first of these that says something:
1
The first non-empty line of detail, with ({type}) on {application} after it on an error
2
{type} on {application}
3
{application}
4
The literal elmah.io alert with no details, so a blank body still reads as something
Nothing past the first line of detail is ever read, which is what keeps the stack frames and their line numbers out of the title.
Use a Title Remapper if your team reads these differently — for example, application first:
Severity
Spike reads the severity field in the body and sets the incident's severity badge from it:
elmah.io severity
Severity in Spike
Fatal
SEV1
Error
SEV2
Warning
SEV2
Information
Left unset — it resolves an incident rather than opening one
Verbose, Debug
Nothing to set — both are dropped before an incident exists
Prerequisites
An elmah.io account, and a user who can edit Rules on the log you want to forward
An elmah.io integration in Spike and its webhook URL
Nothing installed, and nothing changed in your application — rules run on elmah.io's side
Step 1 — Create the integration in Spike
In Spike, go to Integrations → Add integration → elmah.io, attach it to a service and an escalation policy, and copy the webhook URL. It looks like https://hooks.spike.sh/<your-token>/push-events.
The token in that URL is the credential, the same model every other Spike integration uses. elmah.io's HTTP request action needs no header, no signature and no authentication of its own. Treat the URL like a password, and if it leaks, archive the integration and create a new one.
Archive an integrationStep 2 — Add the rule in elmah.io
Open the log's rules: In elmah.io, open the log you want to forward and go to Rules. Rules are per log, so repeat this on every log whose messages should page your on-call.
Create a new rule: Click New rule and give it a name your team will recognise, for example
Send uptime checks to Spike.Choose which messages the rule matches: For uptime checks, turn on elmah.io's built-in Uptime message filter — that one filter matches both the failure and the recovery, which is exactly what you want. For heartbeats, match your heartbeat messages. For application errors, write the query that matches the errors worth waking someone for, for example
severity:Error OR severity:Fatal.Add the action: Under the rule's actions, pick Send a HTTP request.
Point it at Spike: Paste the webhook URL from Step 1 into the URL field.
Paste the body: Put the JSON from the next section into the body field, choosing the one that matches what this rule forwards. Set
event_typeto the single value this rule is for.Copy the variable names from the list the rule editor shows: The rule editor lists the message variables it supports beside the body field, and that list is the authority — not this page. If a value reaches Spike as the literal
$application, that variable does not exist on your account; replace it with the one that does, or drop the key.Save the rule, and repeat it per shape: One rule per
event_type.event_typeis hardcoded in the body, and nothing else in it tells Spike which shape arrived.
The rule bodies
Uptime and heartbeat rules
Paste this into the body field of the rule with the Uptime message filter. Set event_type to Heartbeat instead on the heartbeat rule, and change nothing else:
Error rules
The error rule's body adds the two fields that turn an exception message into something actionable:
Every field is required in the sense that Spike reads it by name, and leaving one out costs you something specific:
event_type
Says which shape this is: Uptime, Heartbeat or Error. Matched in any casing
The message is matched by title, gets no ({type}) on {application}, and never auto-resolves
title
elmah.io's sentence about the fault. The incident title
The title falls back to the first line of detail, then to the type and application
detail
The stack trace, or the check's output. Shown on the incident page, and the title's fallback
Nothing is lost on the title when title arrives
severity
Opens, resolves or drops the message, and sets the severity badge
Every message opens an incident and nothing ever auto-resolves
type
The .NET exception type, appended as ({type}). Error rules only
The title is the bare exception message
application
Which application logged it, appended as on {application}. Error rules only
The title does not say where the exception came from
url
The identity of an uptime check or a heartbeat. Ignored on an error message
Uptime and heartbeat incidents are matched by title instead, and auto-resolve only for wording Spike recognises
Anything you add to the body beyond these fields is kept on the incident and is available to alert rules and the Title Remapper as data.body.<field>. elmah.io's Message carries plenty worth having there — hostname, source, statusCode, method, user, correlationId, category, version — so add the ones your responders read.
Step 3 — Confirm it with a real message
elmah.io has no "send a test message" button on a rule: a rule fires on a message that reaches the log, so verification means producing one.
For an error rule, log a message your query matches. The quickest way is to throw a test exception in a non-production application attached to the same log.
For an uptime rule, point an elmah.io uptime check at an endpoint you control and make it fail — a URL you can return a 503 from, or simply stop the service — and then let it recover.
Watch for all three moments:
An incident opens in Spike with elmah.io's sentence as the title, on the service you attached, escalating through your policy.
The same exception thrown again, or the same check failing again, adds an event to that same incident without paging a second time.
The endpoint recovering logs an
Informationmessage and resolves the incident in Spike.
If the first step works and the third does not, url and severity are the two fields to check on the incident page.
Payload reference
An uptime failure, which opens the incident:
The recovery, from the same rule. Same event_type, same url, a sentence the other way round and severity changed to Information — which is the whole of what tells Spike to resolve:
An application error:
The same exception on the next request carries a different url and different line numbers in detail, and still renders that same title, so it joins the incident already open.
A heartbeat going unhealthy:
Things worth knowing
One rule per shape, not per check. A single uptime rule covers every endpoint elmah.io watches on that log, and every direction. You do not add a rule when you add a check.
Rules are per log. If your applications write to several elmah.io logs, each one needs its own rule. That is also the clean way to split by team: one Spike integration and one rule per log.
Scope the error rule's query. A rule that matches every message on a busy log pages far more than your on-call wants.
severity:Error OR severity:Fatalis a sensible starting point, and alert rules in Spike can suppress the rest.Resolving in Spike does not touch elmah.io. The message stays in the log and the uptime check keeps its own state. Let the
Informationmessage resolve the incident to keep the two sides in step.Verbose and Debug cost you nothing. A rule that forwards them has its messages dropped at Spike rather than turned into incidents, so a rule query that is slightly too wide is not an incident storm.
Troubleshooting
Disclaimer: These integration instructions are offered independently by Spike.sh, and Spike.sh is not affiliated with nor a partner of elmah.io.
Last updated

