Live data from Hacker News

Log level 'error' should mean that something needs to be fixed

utcc.utoronto.ca

11–20 of 313 posts

Re: Log level 'error' should mean that something needs to be fixed

#11
I agree with this.

Not everything that a library considers an error is an application error. If you log an error, something is absolutely wrong and requires attention. If you consider such a log as "possibly wrong", it should be a warning instead.

Re: Log level 'error' should mean that something needs to be fixed

#12
post #3

Yes. Examples of non-defects that should not be in the ERROR loglevel: * Database timeout (the database is owned by a separate oncall rotation that has alerts when this happens) * ISE in downstream service (return HTTP 5xx and increment a metric but don’t emit an error log) * Network error * Downstream service overloaded * Invalid request Basically, when you make a request to another service and get back a status cod…

I wish I lived in a world where that worked. Instead, I live in a world where most downstream service issues (including database failures, network routing misconfigurations, giant cloud provider downtime, and more ordinary internal service downtime) are observed in the error logs of consuming services long before they’re detected by the owners of the downstream service … if they ever are.

My rough guess is that 75% of incidents on internal services were only reported by service consumers (humans posting in channels) across everywhere I’ve worked. Of the remaining 25% that were detected by monitoring, the vast majority were detected long after consumers started seeing errors.

All the RCAs and “add more monitoring” sprints in the world can’t add accountability equivalent to “customers start calling you/having tantrums on Twitter within 30sec of a GSO”, in other words.

The corollary is “internal databases/backend services can be more technically important to the proper functioning of your business, but frontends/edge APIs/consumers of those backend services are more observably important by other people. As a result, edge services’ users often provide more valuable telemetry than backend monitoring.”

Re: Log level 'error' should mean that something needs to be fixed

#13
post #3

Yes. Examples of non-defects that should not be in the ERROR loglevel: * Database timeout (the database is owned by a separate oncall rotation that has alerts when this happens) * ISE in downstream service (return HTTP 5xx and increment a metric but don’t emit an error log) * Network error * Downstream service overloaded * Invalid request Basically, when you make a request to another service and get back a status cod…

I wish I lived in a world where that worked. Instead, I live in a world where most downstream service issues (including database failures, network routing misconfigurations, giant cloud provider downtime, and more ordinary internal service downtime) are observed in the error logs of consuming services long before they’re detected by the owners of the downstream service … if they ever are. My rough guess is that 75% o…

But everything you’re describing can be done with metrics and alerts; there’s no need to spam the ERROR loglevel.

Re: Log level 'error' should mean that something needs to be fixed

#15
post #7

Earlier quoted context omitted.

I’m talking about codes you receive from services you call out to.

Oh that makes sense.

There are still some special cases, because 404 is used for both “There’s no endpoint with that name” and “There’s no record with the ID you tried to look up.”

Re: Log level 'error' should mean that something needs to be fixed

#16
I have been particularly irritated in the past where people use a lower log level and include the higher log level string in the message, especially where it's then parsed, filtered, and alerted on my monitoring.

eg. log level WARN, message "This error is...", but it then trips an error in monitoring and pages out.

Probably breaching multiple rules here around not parsing logs like that, etc. But it's cropped up so many times I get quite annoyed by it.

Re: Log level 'error' should mean that something needs to be fixed

#17
post #10
post #9

Earlier quoted context omitted.

> Database timeout (the database is owned by a separate oncall rotation that has alerts when this happens) So people writing software are supposed to guess how your organization assigns responsibilities internally? And you're sure that the database timeout always happens because there's something wrong with the database, and never because something is wrong on your end?

No; I’m not understanding your point about guessing. Could you restate? As for queries that time out, that should definitely be a metric, but not pollute the error loglevel, especially if it’s something that happens at some noisy rate all the time.

[deleted]

Re: Log level 'error' should mean that something needs to be fixed

#18
I just started playing in the Erlang ecosystem and they have EIGHT levels of logging messages. it seems crazily over-specific, but they are the champions of robust systems.

I could live with 4

Error - alert me now.

Warning - examine these later,

Info - important context for investigations.

Debug - usually off in prod.

Re: Log level 'error' should mean that something needs to be fixed

#20
> This assumes an error/warning/info/debug set of logging levels instead of something more fine grained, but that's how many things are these days.

Does it ?

Don't most stacks have an additional level of triaging logs to detect anomalies etc ? It can be your New relic/DataDog/Sentry or a self made filtering system, but nowadays I'd assume the base log levels are only a rough estimate of whether an single event has any chance of being problematic.

I'd bet the author also has strong opinions about http error codes, and while I empathize, those ships have long sailed.

Post reply on HN