Error Logger Planning #26
Replies: 9 comments 18 replies
-
Feedback from @rowanbeentje via Slack:
Ah yes Alex is working on adding this at the moment. It's a property we're adding to our
I wonder whether these should be configurable. I like the idea of their inclusion but the number of people who can see our Heroku Splunk logs is pretty big. @alexmuller what do you think? I think request ID if we have it would be excellent 👍 edit: I've added |
Beta Was this translation helpful? Give feedback.
-
There's now a draft PR for this work here. Feel free to add discussion here or comment on lines in the PR if that's easier |
Beta Was this translation helpful? Give feedback.
-
I was going to suggest the same. It would be good to use this to encourage the use of the It would also be good to standardise the use of the PII collection in logs so that it's more easily auditable... rather than everyone making it up. There could be some switches to allow you to opt in to collect different levels of PII, rather than per field opt ins. Something like: const createErrorLoggingMiddleware = require('@dotcom-reliability-kit/middleware-log-errors');
app.use(createErrorLoggingMiddleware({
collectPiiClientData: true, // collects IP and user agent data
collectPiiMinimalData: true, // user ID, subscription type ...
collectPiiData: false, // email etc
})); |
Beta Was this translation helpful? Give feedback.
-
How would the values |
Beta Was this translation helpful? Give feedback.
-
Can we rely on splunk to parse urls? |
Beta Was this translation helpful? Give feedback.
-
Overall comments
|
Beta Was this translation helpful? Give feedback.
-
A quick one: given what we've run into the other day, maybe having a Edit: never mind, I saw it's there at the tail end of the example. |
Beta Was this translation helpful? Give feedback.
-
It looks like you may be assuming that any given error you encounter is an instance of HTTP Error (with its status code etc). But I can also see this approach swallowing any error that might originate from an app (now that many repos use package.lock this should be less of an issue) - ask me how I know 😆 |
Beta Was this translation helpful? Give feedback.
-
@rowanbeentje just raised another great point in person. These logs are quite large and maybe we could reduce the footprint by switching out |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Note: bear in mind this discussion is on a public repo
I'm looking at building the error logger now that we have error serialisation merged, this feels like a sensible place to document our thought process so that we can refer back to it later and/or produce some kind of logging spec so that others can implement the same thing.
I think the error logging middleware should be minimally configurable – we don't want it to be so configurable that we end up with inconsistent logs again. I think being opinionated is good. In the app JavaScript it'd look something like this (where
app
is an Express application instance):Here's my first stab at a logging structure. I'm interested in your thoughts:
My main questions are:
What should the
event
property be for an error which is logged by the Express error handling middleware?Should we split
request.url
into separatepath
andquery
properties?Are there any other headers we should log by default? Do the existing defaults make sense?
ShouldI moved route into a sub-property ofroute
be non-optional? I'm mostly thinking if we write a spec then this format might not make sense for the app, for example.request
and think it's fine to be optionalBeta Was this translation helpful? Give feedback.
All reactions