9 ms·
Logging sucks
- firefoxd 10mo agoGood write up. Gonna go on a tangent here. Why the single purpose domain? Especially since the author has a blog. My blog is full of links to single post domains that are no longer.
- OsrsNeedsf2P 10mo agoBecause it's an ad
- thewisenerd 10mo agoit's an ad, for what? i do not see a product upsell anywhere. if it's an ad for the author themselves, then it's a very good one.
- KomoD 10mo agoAt the end there's a form where you can get a "personalized report", I have a feeling that'll advertise some kind of service, it's usually the case.
- danielfalbo 10mo agoI see more and more blog posts that contain interactive elements. Despite the general enshittification of the average blog and the internet, this feels like a 'modern' touch that actually adds something valuable to the sufficient ad-free no-popups old blog style.
- heinrichhartman 10mo agoA post on this topic feels incomplete without a shout-out to Charity Majors - she has been preaching this for a decade, branded the term "wide events" and "observability", and built honeycomb.io around this concept. Also worth pointing out that you can implement this method with a lot of tools these days. Both structured Logs or Traces lend itself to capture wide events. Just make sure to use a tool that supports general query patterns and has rich visualizations (time-series, histograms).
- the_mitsuhiko 10mo ago> A post on this topic feels incomplete without a shout-out to Charity Majors I concur. In fact, I strongly recommend anyone who has been working with observability tools or in the industry to read her blog, and the back story that lead to honeycomb. They were the first to recognize the value of this type of observability and have been a huge inspiration for many that came after.
- loevborg 10mo agoI've learned more from Charity about telemetry than from anyone else. Her book is great, as are her talks and blog posts. And Honeycomb, as a tool, is frankly pretty amazing Yep, I'm a fan.
- dcminter 10mo agoCould you drop a few specific posts here that you think are good for someone (me) who hasn't read her stuff before? Looks like there's a decade of stuff on her blog and I'm not sure I want to start at the very beginning...
- simonw 10mo agoA few of my favourites: - Software Sprawl, The Golden Path, and Scaling Teams With Agency: https://charity.wtf/2018/12/02/software-sprawl-the-golden-path-and-scaling-teams-with-agency/ https://charity.wtf/2018/12/02/software-sprawl-the-golden-pa... - introduces the idea of the "golden path", where you tell engineers at your company that if they use the approved stack of e.g. PostgreSQL + Django + Redis then the ops team will support that for them, but if they want to go off path and use something like MongoDB they can do that but they'll be on the hook for ops themselves. - Generative AI is not going to build your engineering team for you: https://stackoverflow.blog/2024/12/31/generative-ai-is-not-going-to-build-your-engineering-team-for-you/ https://stackoverflow.blog/2024/12/31/generative-ai-is-not-g... - why generative AI doesn't mean you should stop hiring junior programmers. - I test in prod: https://increment.com/testing/i-test-in-production/ https://increment.com/testing/i-test-in-production/ - on how modern distributed systems WILL have errors that only show up in production, hence why you need to have great instrumentation in place. "No pull request should ever be accepted unless the engineer can answer the question, “How will I know if this breaks?”" - Advice for Engineering Managers Who Want to Climb the Ladder: https://charity.wtf/2022/06/13/advice-for-engineering-managers-who-want-to-climb-the-ladder/ https://charity.wtf/2022/06/13/advice-for-engineering-manage... - The Engineer/Manager Pendulum: https://charity.wtf/2017/05/11/the-engineer-manager-pendulum/ https://charity.wtf/2017/05/11/the-engineer-manager-pendulum... - I LOVE this one, it's about how it's OK to have a career where you swing back and forth between engineering management and being an "IC".
- alexwennerberg 10mo ago> Logs were designed for a different era. An era of monoliths, single servers, and problems you could reproduce locally. Today, a single user request might touch 15 services, 3 databases, 2 caches, and a message queue. Your logs are still acting like it's 2005. If a user request is hitting that many things, in my view, that is a deeply broken architecture.
- the_mitsuhiko 10mo ago> If a user request is hitting that many things, in my view, that is a deeply broken architecture. If we want it or not, a lot of modern software looks like that. I am also not a particular fan of building software this way, but it's a reality we're facing. In part it's because quite a few services that people used to build in-house are now outsourced to PaaS solutions. Even basic things such as authentication are more and more moving to third parties.
- worik 10mo ago> but it's a reality we're facing. Yes. Most software is bad The incentives between managers and technicians are all wrong Bad software is more profitable, over the time frames managers care about, than good software
- the_mitsuhiko 10mo agoThe reason we end up with very complex systems I don't think is because of incentives between "managers and technicians". If I were to put my finger to it, I would assume it's the very technicians who argued themselves into a world where increased complexity and more dependencies is seen as a good thing. Fighting complexity is deeply unpopular.
- 0x3f 10mo agoAt least in my place of work, my non-technical manager is actually on board with my crusade against complex nonsense. Mostly because he agrees it would increase feature velocity to not have to touch 5 services per minor feature. The other engineers love the horrific mess they've built. It's almost like they're roleplaying working at Google and I'm ruining the fun.
- jsonsuxorz 10mo ago[dead]
- jdpage 10mo agoTangential, but I wonder if the given example might be straying a step too far? Normally we want to keep sensitive data out of logs, but the example includes a user.lifetime_value_cents field. I'd want to have a chat with the rest of the business before sticking something like that in logs.
- nightpool 10mo agoIn some companies, this type of information is often very important and very easily available to everyone at all levels of the business to help prioritize and understand customer value. I would not consider it "sensitive" in the same way that e.g. PII would be.
- jdpage 10mo agoGood to know! At previous jobs, that information wasn't available to me (and it didn't matter because the customer bases were small enough that every customer was top priority), so I assumed it was considered more sensitive than it perhaps is.
- zkmon 10mo ago> Logs were designed for a different era. An era of monoliths, single servers, and problems you could reproduce locally. Today, a single user request might touch 15 services, 3 databases, 2 caches, and a message queue. Your logs are still acting like it's 2005. Logs are fine. The job of local logs is to record the talk of a local process. They are doing this fine. Local logs were never meant to give you a picture of what's going on some other server. For such context, you need a transaction tracing that can stitch the story together across all processes involved. Usually, looking at the logs at right place should lead you to the root cause.
- holoduke 10mo agoAPN/Kibana. All what I need for inspecting logs.
- devmor 10mo agoShoutout to Kibana. Absolutely my favorite UI tool for trying to figure out what went wrong (and sometimes, IF anything went wrong in the first place)
- venturecruelty 10mo ago[flagged]
- otterley 10mo agoOne of the points the author is trying to make (although he doesn't make it well, and his attitude makes it hard to read) is that logs aren't just for root-causing incidents. When properly seasoned with context, logs give you useful information like who is impacted (not every incident impacts every customer the same way), correlations between component performance and inputs, and so forth. When connected to analytical engines, logs with rich context can help you figure out things like behaviors that lead to abandonment, the impact of security vulnerability exploits, and much more. And in their never-ending quest to improve their offerings and make more money, product managers love being able to test their theories against real data.
- CamperBob2 10mo ago[flagged]
- kgklxksnrb 10mo agoAre you using black text on white in your terminals as well?
- ohans 10mo agoThis was a brilliant write up, and loved the interactivity. I do think "logs are broken" is a bit overstated. The real problem is unstructured events + weak conventions + poor correlation. Brilliant write up regardless
- the__alchemist 10mo agoFrom what I gather: This is referring to Web sites or other HTTP applications which are internally implemented as a collection of separate applications/ micro-services?
- cowsandmilk 10mo agoHorrid advice at the end about logging every error, exception, slow request, etc if you are sampling healthy requests. Taking slow requests as an example, a dependency gets slower and now your log volume suddenly goes up 100x. Can your service handle that? Are you causing a cascading outage due to increased log volumes? Recovery is easier if your service is doing the same or less work in a degraded state. Increasing logging by 20-100x when degraded is not that.
- otterley 10mo agoIt’s an important architectural requirement for a production service to be able to scale out their log ingestion capabilities to meet demand. Besides, a little local on-disk buffering goes a long way, and is cheap to boot. It’s an antipattern to flush logs directly over the network.
- lanstin 10mo agoAnd everything logging from the API to the network to the ingestion pipeline needs to be best effort - configure a capacity and ruthlessly drop msgs as needed, at all stages. Actually a nice case for UDP :)
- otterley 10mo agoIt depends. Some cases like auditing require full fidelity. Others don’t. Plus, if you’re offering a logging service to a customer, the customer’s expectation is that once successfully ingested, your service doesn’t drop logs. If you’re violating that expectation, this needs to be clearly communicated to and assented by the customer.
- lanstin 10mo ago1. those ingested logs are not logs for you, they are customer payload which are business criticial; 2. I've yet to see a Logging as a Service provider not have outages where data was lost or severely delayed. Also, the alternative to best effort/shed excessive load isn't 100% availability, it's catastrophic failure when capacity is reached. Auditing has the requirement to be mostly not lost, but most importantly not being able to be deleted by people on the host. And for the capacity side, again the design question is "what happens when incoming events exceed our current capacity - all the collectors/relays balloon their memory and become much much slower, effectively unresponsive, or immediately close the incoming sockets, lower downstream timeouts, and so on." Hopefully, the audit traffic is consistent enough that you don't get spikes and can over-capacitize with confidence.
- kgklxksnrb 10mo agoLogfiles are a user interface.
- otterley 10mo agoThe substance of this post is outstanding. The framing is not, though. Why does it have to sound so dramatic and provocative? It’s insulting to its audience. Grumpiness, in the long term, is a career-limiting attitude.
- b0ringdeveloper 10mo agoI get the AI feeling from it.
- otterley 10mo agoIt might have been AI-assisted, and it might not have been. It doesn’t really matter. The author is ultimately responsible for the end result.
- rglover 10mo agoCareer-limiting perhaps (if expressing normal human emotion is a minus inside of an organization, it may be time to bail) but some of the best minds I've met/observed were absolute curmudgeons (with purpose—they were properly bothered by a problem and refused to go along with the "sweep it under the rug" behavior). Sure, I've dealt with plenty of assholes, too, but the grumps are usually just tired of their valid insight being ignored by more foolish, orthogonally incentivized types (read: "playing the game" not "making it work well").
- otterley 10mo agoWe've all tolerated the grumpy genius at some point in our careers. Nevertheless, most of us would prefer to work with a person who's both smart and kind over someone who's smart and curmudgeonly. It is possible to be both smart and kind, and I've had the pleasure of working with such people. Assholes can sap an organization's strength faster than any productive value their intelligence can provide. I'm not suggesting the author is an asshole, though; there's not enough evidence from this post.
- jupin 10mo agoSome excellent points raised in this article.
- charcircuit 10mo agoThis article is attacking a strawman. It makes up terrible logs and then says they are bad. Even if this was a single monolith the logs still don't include even something like a thread id, to avoid mixing different requests together.
- blinded 10mo agoI see logs worse that that on the daily.
- dcminter 10mo agoI've generally found that structured logs that include a correlation ID make it quite easy to narrow down the general area or exact cause of problems. Usually (in enterprise orgs) via Splunk or Datadog. Where I've had problems it's usually been one of: There wasn't anything logged in the error block. A comment saying "never happens" is often discovered later :) Too much was logged and someone mandated dialing the logging down to save costs. Sigh. A new thread was started and the thread-local details including the correlation ID got lost, then the error occurred downstream of that. I'd like better solutions for that one. Edit: Incidentally a correlation ID is not (necessarily) the same thing as a request ID. An API often needs to allow for the caller making multiple calls to achieve an objective; 5 request IDs might be tied to a single correlation ID.
- loglog 10mo agoJava has a solution for the thread problem: Scoped Values [0]. If only the logging+tracing libraries would start using it... [0] https://openjdk.org/jeps/506 https://openjdk.org/jeps/506
- dcminter 10mo agoOh, excellent, these slipped under my radar. Sounds extremely promising and I do mostly work in Java!
- Spivak 10mo agoSlapping on OpenTelemetry actually will solve your problem. Point #1 isn't true, auto instrumentation exists and is really good. When I integrate OTel I add my own auto instrumentors wherever possible to automatically add lots of context. Which gets into point #2. Point #2 also isn't true. It can add business context in a hierarchal manner and ship wide events. You shouldn't have to tell every span all the information again. Just where it appears naturally the first time. Point #3 also also isn't true because OTel libs make it really annoying to just write a log message and very strongly pushes you into a hierarchy of nested context managers. Like the author's ideal setup is basically using OTel with Honeycomb. You get the querying and everything. And unlike rawdogging wide events all your traces are connected, can span multiple services and do timing for you.
- deleted 10mo ago[deleted]
- Aiisnotabubble 10mo ago[dead]
- yujzgzc 10mo agoYou might also need different systems for low-cardinality, low-latency production monitoring (where you want to throw alerts quickly and high cardinality fields would just get in the way), and medium to long term logging with wide events. Also if you're going to log wide events, for the sake of the person querying them after you, please don't let your schema be an ad hoc JSON dict of dicts, put some thought into the schema structure (and better have a logging system that enforces the schema).
- m3047 10mo agoI agree with this statement: "Instead of logging what your code is doing, log what happened to this request." but the impression I can't shake is that this person lacks experience, or more likely has a lot of experience doing the same thing over and over. "Bug parts" (as in "acceptable number of bug parts per candy bar") logging should include the precursors of processing metrics. I think what he calls "wide events" I call bug parts logging in order to emphasize that it also may include signals pertaining to which code paths were taken, how many times, and how long it took. Logging is not metrics is not auditing. In particular processing can continue if logging (temporarily) fails but not if auditing has failed. I prefer the terminology "observables" to "logging" and "evaluatives" to "metrics". In mature SCADA systems there is the well-worn notion of a "historian". Read up on it. A fluid level sensor on CANbus sending events 10x a second isn't telling me whether or not I have enough fuel to get to my destination (a significant question); however, that granularity might be helpful for diagnosing a stuck sensor (or bad connection). It would be impossibly fatiguing and hopelessly distracting to try to answer the significan question from this firehose of low-information events. Even a de-noised fuel gauge doesn't directly diagnose my desired evaluative (will I get there or not?). Does my fuel gauge need to also serve as the debugging interface for the sensor? No, it does not. Likewise, send metrics / evaluatives to the cloud not logging / observables; when something goes sideways the real work is getting off your ass and taking a look. Take the time to think about what that looks like: maybe that's the best takeaway.
- otterley 10mo ago> Logging is not metrics is not auditing. I espouse a "grand theory of observability" that, like matter and energy, treats logs, metrics, and audits alike. At the end of the day, they're streams of bits, and so long as no fidelity is lost, they can be converted between each other. Audit trails are certainly carried over logs. Metrics are streams of time-series numeric data; they can be carried over log channels or embedded inside logs (as they often are). How these signals are stored, transformed, queried, and presented may differ, but at the end of the day, the consumption endpoint and mechanism can be the same regardless of origin. Doing so simplifies both the conceptual framework and design of the processing system, and makes it flexible enough to suit any conceivable set of use cases. Plus, storing the ingested logs as-is in inexpensive long-term archival storage allows you to reprocess them later however you like.
- mrkeen 10mo ago> Your logs are lying to you. Not maliciously. They're just not equipped to tell the truth. The best way to equip logs to tell the truth is to have other parts of the system consume them as their source of truth. Firstly: "what the system does" and "what the logs say" can't be two different things. Secondly: developers can't put less info into the logs than they should, because their feature simply won't work without it.
- 8n4vidtmkvmk 10mo agoThat doesn't sound like a good plan. You're coupling logging with business logic. I don't want to have to think if i change a debug string am i going to break something.
- andoando 10mo agoYour logic wouldn't be dependent on a debug string, but some enum in a structured field. Ex, event_type: CREATED_TRANSACTION. Seeing logging as debugging is flawed imo. A log is technically just a record of what happened in your database.
- SoftTalker 10mo agoYou're also assuming your log infrastructure is a lot more durable than most are. Generally, logging is not a guaranteed action. Writing a log message is not normally something where you wait for a disk sync before proceeding. Dropping a log message here or there is not a fatal error. Logs get rotated and deleted automatically. They are designed for retroactive use and best effort event recording, not assumed to be a flawless record of everything the system did.
- mrkeen 10mo ago> You're also assuming your log infrastructure is a lot more durable than most are. Make actions, not assumptions. Instead of using a one machine storage system, distribute that storage across many machines. Then stop deleting them. > Dropping a log message here or there is not a fatal error. I would try to reallocate my effort budget to things that actually need to work. Drop logging completely, and come back to it once you have a flawless record of everything the system did. The reconsider whether you need it.
- tetha 10mo agoOne thing this is missing: Standardization and probably the ECS' idea of "related" fields. A common problem in a log aggregation is the question if you query for user.id, user_id, userID, buyer.user.id, buyer.id, buyer_user_id, buyer_id, ... Every log aggregation ends up being plagued by this. You need standard field names there, or it becomes a horrible mess. And for a centralized aggregation, I like ECS' idea of "related". If you have a buyer and a seller, both with user IDs, you'd have a `related.user.id` with both id's in there. This makes it very simple to say "hey, give me everything related to request X" or "give me everything involving user Y in this time frame" (as long as this is kept up to date, naturally)
- ttoinou 10mo agoI always wondered why we didnt have some kind of fuzzy english words search regexes/tool, that is robust to keyboard typing mistakes, spelling mistake, synonyms, plural, conjugation etc.
- j-pb 10mo agoI actually wrote my bachelors on this topic, but instead of going the ECS route (which still has redundant fields in different components) I went in the RDF direction. That system has shifted towards more of a middleware/database hybrid over time (https://github.com/triblespace/triblespace-rs https://github.com/triblespace/triblespace-rs). I always wonder if we'd actually need logging if we had more data-oriented stacks where the logs fall out as a natural byproduct of communication and storage.
- deleted 10mo ago[deleted]
- thevinter 10mo agoThe presentation is fantastic and I loved the interactive examples! Too bad that all of this effort is spent arguing something which can be summarised as "add structured tags to your logs" Generally speaking my biggest gripe with wide logs (and other "innovative" solutions to logging) is that whatever perceived benefit you argue for doesn't justify the increased complexity and loss of readability. We're throwing away `grep "uid=user-123" application.log` to get what? The shipping method of the user attached to every log? Doesn't feel an improvement to me... P.S. The checkboxes in the wide event builder don't work for me (brave - android)
- dannyfreeman 10mo agoDo you really loose the ability to grep? You can still search for json fragments `grep '"uid": "user-123"' application.log` If the json logged isn't pretty printed everything should still be on one line. You can also grep with the `--context` flag to get more surrounding lines.
- mrkeen 10mo agoIt's not even that bad. As long as it's actual json, it doesn't matter if it's pretty-printed or not, since `jq` can fold and unfold it at will. I frequently fold logs into single lines, grep for something, then unfold them again
- bambax 10mo ago> Logging Sucks But does it? Or is it bad logging, or excessive logging, or unsearchable logs? A client of mine uses SnapLogic, which is a middleware / ETL that's supposed run pipelines in batch mode to pass data around between systems. It generates an enormous amount of logs that are so difficult to access, search and read that they may as well don't exist. We're replacing all of that with simple Python scripts that do the same thing and generate normal simple logs with simple errors when something's truly wrong or the data is in the wrong format. Terse logging is what you want, not an exhaustive (and exhausting) torrent of irrelevant information.
- asdev 10mo agothis is the best lead generation form i've ever seen
- roncesvalles 10mo agoAI slop blogvert. The first example is disingenuous btw. Everyone these days uses requestIDs to be able to query all log lines emanated by a single request, usually set by the first backend service to receive the request and then propagated using headers (and also set in the server response). There isn't anything radical about his proposed solutions either. Most log storage can be set with a rule where all warning logs or above can be retained, but only a sample of info and debug logs. The "key insight" is also flawed. The reason why we log at every step is because sometimes your request never completes and it could be for 1000 reasons but you really need to know how far it got in your system. Logging only a summary at the end is happy path thinking.
- mnahkies 10mo agoThat was difficult to read, smelt very AI assisted though the message was worthwhile, it could've been shorter and more to the point. A few things I've been thinking about recently: - we have authentication everywhere in our stack, so I've started including the user id on every log line. This makes getting a holistic view of what a user experienced much easier. - logging an error as a separate log line to the request log is a pain. You can filter for the trace, but it makes it hard to surface "show me all the logs for 5xx requests and the error associated" - it's doable, but it's more difficult than filtering on the status code of the request log - it's not enough to just start including that context, you have to educate your coworkers that it's now present. I've seen people making life hard for themselves because they didn't realize we'd added this context
- spike021 10mo agoIf your codebase has the concept of a request ID, you could also feasibly use that to trace what a user has been doing with more specificity.
- mnahkies 10mo agoWe do have both a span id and trace id - but I personally find this more cumbersome over filtering on a user id. YMMV if you're interested in a single trace then you'd filter for that, but I find you often also care what happened "around" a trace
- ivan_gammel 10mo ago…and the same ID can be displayed to user on HTTP 500 with the support contact, making life of everyone much easier.
- dexwiz 10mo agoI have seen pushback on this kind of behavior because "users don't like error codes" or other such nonsense. UX and Product like to pretend nothing will ever break, and when it does they want some funny little image, not useful output. A good compromise is to log whenever a user would see the error code, and treat those events with very high priority.
- bob1029 10mo ago> Logs were designed for a different era. An era of monoliths, single servers, and problems you could reproduce locally. I worked with enterprise message bus loggers in semiconductor manufacturing context wherein we had thousands of participants on the message bus. It generated something like 300-400 megabytes per hour. Despite the insane volume we made this work really well using just grep and other basic CLI tools. The logs were mere time series of events. Figuring out the detail about specific events (e.g. a list of all the tools a lot visited) required writing queries into the Oracle monster. You could derive history from the event logs if you had enough patience & disk space, but that would have been very silly given the alternative option. We used them predominantly to establish a casual chain between events when the details are still preliminary. Identifying suspects and such. Actually resolving really complicated business usually requires more than a perfectly detailed log file.
- iLoveOncall 10mo ago> It generated something like 300-400 megabytes per hour. Despite the insane volume we made this work really well using just grep and other basic CLI tools. 400MB of logs an hour is nothing at all, that's why a naive grep can work. You don't even need to rotate your log files frequently in this situation.
- fsniper 10mo agoAt last a sane person. Logs are for identifying the event timeline, not to acquire the whole reqs/resp data. Putting every detail into the logs is -in my experience - makes undertanding issues harder. Logs tell a story. When, what happened, not how or why that happened. Why is in the code, how is in the combination of, data, logs, events, code. And loosely related, I also dislike log interfaces like elk stack. They make following track of events really hard. Most of the time you do not know what you are loooking for, just a vauge understanding of why you are looking into the logs. So a line passed 3 micro seconds ago maybe your euraka moment, where no search could identify , just intuition and following logs diligently can.
- eterm 10mo agoOverly dismissive of OTLP without proper substance to the criticism.
- tuetuopay 10mo agoOn some languages the tracing frameworks are a godsend. In Rust the instrument macro will automatically record all function arguments as span tags. Plonk anything in e.g jaeger and any full trace can be looked up from pretty much any value.
- ivan_gammel 10mo agoThe problem statement in this article sounds weird. I thought in 2025 everyone logs at least thread id and context id (user id, request id etc), and in microservice architecture at least transaction or saga id. You don’t need structured logging, because grep by this id is sufficient for incident investigation. And for analytics and metrics databases of events and requests make more sense.
- ardme 10mo agoMaybe better written and simplified to: “microservices suck”.
- exabrial 10mo agoOur logging guidance is: "Don't write comments, write logs" and that serves us pretty well. The point being, don't write code "clever code", write obvious code, and try to make it similar to everything else thats been done, regardless if you agree with it.
- lstroud 10mo agoSounds like he’s just asking for an old school Inman style transaction log.
- UltraSane 10mo agoSplunk is expensive but it makes searching logs so much faster and more effective. I think of it as SQL for unstructured data.
- preisschild 10mo agoloki works great too and is FOSS
- UltraSane 10mo agoWe really need an open-source implementation of the Splunk Query Language. The query language is what lets you actually find the few dozen relevant lines out of the billions of lines logged.
- KingLancelot 10mo ago[dead]
- theodpHN 10mo agoJust out of curiosity, how have you seen risk/compliance, regulatory, and audit departments at organizations deal with the disconnect between security and privacy for something like mainframe logging (e.g., JES2, JES3), which is typically inherently governed, and modern distributed logging, which is typically inherently permissive? Both are vastly different approaches, but each is somehow considered 'compliant.' Btw, employees at a company I was at were once investigated for insider trading simply because it was discovered the company used pooled logs that were accessible by production support programmers (the company decided to override the default mainframe security), which was deemed a possible source of insider trading information that could be tapped into by those who had log access (programmers were eventually cleared if it was discovered their small personal trades were immaterial and just coincidental with the company's trading, but the investigation led to uncomfortable confrontations for some!).
- shireboy 10mo agoKinda get what he’s saying: provide more metadata with structured logging as opposed to lots of string only logs. Ok, modern logging frameworks steer you towards that anyway. But as a counterpoint: often it can be hard to safely enrich logging like that. In the example they include subscription age, user info, etc. More than once I’ve seen logging code lookup metadata or assume it existed, only to cause perf issues or outright errors as expected data didn’t exist. Similar with sampling, it can be frustrating when the thing you need gets sampled out. In the end “it depends” on scenario, but I still find myself not logging enough or else logging too much
- Lord_Zero 10mo agoStructured Logging is not just JSON. It's the use of templates with context. It solves 90% of what this article complains about if you just log the template along with the variables and the message separately. Along with logging the right stuff. IE `"User {username} created order {orderid}"`
- sapphirebreeze 10mo ago[dead]
- nacozarina 10mo agoAI writing sucks even more, get rekt
- adamddev1 10mo ago> Today, a single user request might touch 15 services, 3 databases, 2 caches, and a message queue. And this is why _the internet_ today sucks.
- redleader55 10mo agoThe article, AI or not, is extremely naive. It doesn't mention any premise or any problem to solve. Proposes a solution and just goes with it. What if your monster of a event is lost when your service crashes or is lost by the logging library/service/etc? What if you're interested in measuring, post factum, how long each step takes? What if you want to trace a log through several (micro-)services and maybe between a mobile app and some batch job executor that runs once a day? "Logging sucks" when you don't understand the problem you're trying to solve.
- gfody 10mo agothe best implementation of structured logging I've seen is dotnet build's binlogs (https://msbuildlog.com https://msbuildlog.com), I would love to see it evolve into a general purpose logging solution
- kalmyk 10mo agodistributed event id and you are all set
- grekowalski 10mo ago"Logs were designed for a different era. An era of monoliths, single servers, and problems you could reproduce locally." But the next era will be like the previous one. Today monolith is enough for most of apps.
- yoan9224 10mo agoLogs were designed for a different era. An era of monoliths, single servers, and problems you could reproduce locally. Today, a single user request might touch 15 services, 3 databases, 2 caches, and a message queue. If a user request is hitting that many things, in my view, that is a deeply broken architecture. I'm building an analytics SaaS and we made the conscious decision to keep it simple: Next.js API routes + Supabase + minimal external services. A single page view hits maybe 3 components max (CDN -> App -> Database). That said, I agree completely on structured logging with rich context. We include user_id, session_id, and event_type on every log line. Makes debugging infinitely easier. The "wide events" concept is solid, but the real win is just having consistent, searchable structure. You don't need a revolutionary new paradigm - just stop logging random strings and use JSON with a schema.
- joeyguerra 10mo agoPersisting a data schema that represents business events is a great idea. That’s more about Event Sourcing though and doing that can answer a ton of questions about the system without doing it in log messages. Wide events as a strategy is expensive, even with sampling, and doesn’t address the fundamental problem - why do we log messages? I was hoping the article would enumerate why we log messages. Nailing down those scenarios first will lead to a happy life. Why do we log? - proof of life - is the system running? - what is the state (in memory) when an error occurred? - when did an error occur? - do I need to get up at 2 am and fix something? - what do I need to fix? I feel like every team operating a system has their own reasons for logging.
- fny 10mo agoThis seems like a classic time vs space trade off. Instead of reconstructing a "wide event" from multiple log lines with the same request id, the suggestion seems to be logging wide events repeatedly to simplify reconstruction from request ids. I personally don't see the advantage, and in either scenario, if you're not logging what's needed your screwed.
- Hackbraten 10mo ago> No grep-ing. How is grep a bad thing? I find myself using it all the time. I’m not into graphical user interfaces. They overwhelm me. By the time I’ve clicked myself through the GUI or written some horrible proprietary $COMPANY Query Language string, I might have already figured out the bug using tried and tested CLI tools.
- duckmysick 10mo agoMe neither. When I deal with structured logs, I use Structured Query Language, typically with ClickHouse or DuckDB which are CLI tools too. grep is all right, but sometimes I need to tease out a complex data relationship.
- thangalin 10mo agoUse events instead of repetitious logging calls. https://dave.autonoma.ca/blog/2022/01/08/logging-code-smell/ https://dave.autonoma.ca/blog/2022/01/08/logging-code-smell/
- XCSme 10mo agoI've recently added error tracking to my self-hosted analytics app (UXWizz), and the way I did it is simply add extra events to each user/session. Once you have the concept of a session or user, you can simply attach errors or logs as Events stored for that user. This solves the main problem mentioned in the article, where you don't know what happened, plus being an Event stored in a MySQL database, you can still query it. Why not simply use Events for logging, instead of plain strings?
- Illniyar 10mo agoWhile I agree with some of it, I feel like there's a big gotcha here that isn't addressed. Having 1 single wide event, at the end of a request, means that if something unexpected happens in the middle (stack overflow, some bug that throws an error that bypasses your logging system, lambda times out etc...) you don't get any visibility into what happens. You also most likely lose out on a lot of logging frameworks your language has that your dependencies might use. I would say this is a good layer to put on top of your regular logs. Make sure you have a request/session wide id and aggregate all those in your clickhouse or whatever into a single "log".
- wesammikhail 10mo agoThe way I have solved for this in my own framework in PHP is by having a Logging class with the following interface interface LoggerInterface { // calls $this->system(LEVEL_ERROR, ...); public function exception(Throwable $e): void; // Typical system logs public function system(string $level, string $message, ?string $category = null, mixed ...$extra): void; // User specific logs that can be seen in the user's "my history" public function log(string $event, int|string|null $user_id = null, ?string $category = null, ?string $message = null, mixed ...$extra): void; } I also have a global exception handler that is registered at application bootstrap time that takes any exception that happens at runtime and runs $logger->exception($e); There is obviously a tiny bit more of boilerplating to this to ensure reliability, but it works so well that I can't live without it anymore. The logs are then inserted into a wide DB table with all the field one could ever want to examine thanks to the variadic parameter.
- hu3 10mo agoNice. I guess you write logs on the "final" block of a global try/catch/final? Something like: try { // handle request code } catch (...) { // add exceptions to log } final { // insert logs into DB }
- wesammikhail 10mo agoI used to do it like that and it worked really well but I changed the flow to where exceptions are actually part of the control flow of the app using PHP's set_exception_handler(), set_error_handler() and register_shutdown_function(). Example, lets say a user forgot to provide a password when authenticating, then I will throw a ClientSideException(400, "need password yada yada"); That exception will bubble up to the exception_handler that logs and outputs the proper message to the screen. Similarly if ANY exception is thrown, regardless of where it originated, the same will happen. When you embrace exceptions as control flow rather than try to avoid them, suddenly everything gets 10x easier and I end up writing much less code overall.
- paragraft 10mo agoI've recently come off a team that was racking up a huge Splunk bill with ~70 log events for each request on a high traffic service, and this is all very resonant (except the bit about sampling, I never gave that much thought - reducing our Splunk bill 70x was ambitious enough for me!). Hadn't heard the "wide event" name, but I had settled on the same idea myself in that time (called them "top-level events" - i.e. we would gather information from the duration of the request and only log it at the "top" of the stack at the end), and evangelised them internally mostly on the basis it gave you fantastic correlation ability. In theory if you've got a trace id in Splunk you can do correlated queries anyway, but we were working in Spring and forever having issues with losing our MDC after doing cross-thread dispatch and forgetting to copy the MDC thread global across. This wasn't obvious from the top-level, and usually only during an incident would you realise you weren't seeing all the loglines you expected for a given trace. So absent a better solution there, tracking debug info more explicitly was appealing. Also used these top-level events to store sub-durations (e.g. for calling downstream services, invoking a model etc), and with Splunk if you record not just the length of a sub-process but its absolute start, you can reconstruct a hacky waterfall chart of where time was spent in your query.
- efitz 10mo agoBecause of the nature of how software is built and deployed nowadays, it’s generally not possible to write single log entries that tell the “whole story” of “what happened”. I could write about this for hours, but instead I’ll just discuss two concepts that you need in modern logging: vertical correlation and horizontal correlation. Within a system, requests tend to go “up” and “down” stacks of software. It is very useful in these scenarios to have “vertical correlation” fields shared between adjacent layers, so that activity in one layer can be unambiguously attributed to activity in the adjacent layers. But sharing such a correlation value requires passing the value between layers, which might be a breaking api change. Occasionally it’s possible to construct a correlation value at each adjacent layer by transforming existing parameters in exactly the same way on the calling side and called side. Additionally, software on one system converses with software on other systems; in those cases you need to have pairwise correlation values between adjacent peer layers. Again, same limitations apply to carrying such a correlation value via the API or protocol. Really foresighted devs can anticipate these requirements and generate unique transaction ids that can be shared between machines and up and down the stack.
- simonw 10mo agoI hope registering an entire domain name for a blog post doesn't become a trend. I like linking to things that are likely to last a long time - a personal blog is one thing, but expecting people to keep paying the renewal fee every year for a single article feels less likely to me. A good alternative here is subdomains, since those don't have an additional annual fee. https://logging-sucks.boristane.com/ https://logging-sucks.boristane.com/ could work well here.
- willempienaar 10mo agoI kind of agree, but the message in this particular post does border on https://simonwillison.net/2024/Jul/13/give-people-something-to-link-to/ https://simonwillison.net/2024/Jul/13/give-people-something-...
- simonw 10mo agoMaybe I should have written "Give people something to link to that they can expect to stick around for a very long time"
- flockonus 10mo agoSorry, this is not a "blog post" - it's far closer to digital marketing. A lead attractor as the author is trying to sell a service very clearly by the end of his page (no disrespect meant to either).
- jspash 10mo agoThe domain and article just a long-form advert for the author's observability sass. Oddly it's free, but you have to sign up for Cloudlfare, where the author is currently employed. It's seems they are playing the long-long game! All snarkiness aside, I learned a few things from the article. And I might even sign up to the sass since I already have a CF account.
- etamponi 10mo ago> Logs were designed for a different era. An era of monoliths, single servers, and problems you could reproduce locally. Today, a single user request might touch 15 services, 3 databases, 2 caches, and a message queue. Your logs are still acting like it's 2005. Perhaps it's time to take back the good things from 2005.
- 0xbadcafebee 10mo ago> Here's the mental model shift that changes everything: Instead of logging what your code is doing, log what happened to this request. Yeah that doesn't magically fix everything. Logging is still an arbitrary, clunky, unintuitive process that requires intentional design and extra systems to be useful. The "Wide Event log" example is 949 bytes, which isn't unmanageably large, but it is 3x larger than most log messages which are about 300 bytes. And in that blob of data might be key insights, but it is left up to an extra engineering process to discover what might be unusual in that blob. It lacks things like code line numbers, stack trace, and context given by the program about its particular functions (rather than assumptions based on a few pieces of metadata). And it's excessively verbose, as it has a trace and request ID and service name, but duplicates information already available to tracing systems based on those 3 metrics. > Wide events are a philosophy: one comprehensive event per request, with all context attached. That's simply impossible. You cannot have all context from viewing a single point in the network, regardless of how hard you try to record or pass on information. That's the whole point of tracing: you correlate the context of different network points, specifically because that's the only way to discover the missing details. > Modern columnar databases (ClickHouse, BigQuery, etc.) are specifically designed for high-cardinality, high-dimensionality data. The tooling has caught up. Your practices should too. You should not depend on a space shuttle to get to the grocery store. Logging is intended to be an abstracted component which can be built on by other systems. Your app should work just as well running from Docker on your laptop as it does in the cloud.
- zX41ZdbW 10mo agoClickHouse is a tiny component - a single binary that runs on a laptop.
- scolvin 10mo agoCorrection, logging used to suck - now it's fixed https://pydantic.dev/logfire https://pydantic.dev/logfire :-)
- groundzeros2015 10mo ago> An era of monoliths, single servers, and problems you could reproduce locally. Actually this is the problem. It’s extremely difficult to debug when you do not preserve basic properties that allow you to read code and reason about events.
- KaiserPro 10mo agoI agree that logging suck bollocks, especially when most of the time you really want metrics. Opentel is great, but sadly A lot of the stuff that I am using doesn't support it. The thing that made it much more bearable, even easy is loki and a decent log parser. I know a lot of kids like using SQL to interact with things, loki's explore interface beats the living shit out of SQL (In my opinion) its really simple to just isolate and slice logs interactivly. You can build your query really simply. It beats splunk/sumo/scuba(facebook's log system) hands down in terms of searchability.
- mkarrmann 10mo agoI broadly agree with the article. The described pattern is standard in Meta. This, along with the infrastructure and tooling to support it, was the single largest "devx quality of life improvement" in my experience moving to big tech.
- hoppp 10mo ago"Today, a single user request might touch 15 services, 3 databases, 2 caches, and a message queue." This right here is the fundamental problem because the way it's done is highly inefficient, complex and I believe only exists so cloud providers can sell their expensive offerings. A monolith is fine 90% of the time.
- sgarland 10mo agoThat, and everyone thinks they have to do things this way, so it’s a terrible cycle. So many problems would be solved if service calls were IPC instead of network calls.
- hoppp 10mo agoYe, even the smallest projects nowadays are either serverless or run in kubernetes, they never even think about IPC. Modern deployment pipelines are very good at deploying services that are running in separate containers, and people hate custom shell scripts, even if they work great. If it's bespoke and not standardized its harder to maintain that's true, but its also great at reducing operational costs because infrastructure fees change with less reliance on external services . Its a cycle alright.
- juancn 10mo agoLogging is one tool of many, you need logs, metrics and distributed tracing at the very least for any significant piece of modern infra. If you really want to get serious, you also want some kind of continuous profiling (like pyroscope) or at the very least some periodic thread dump collector (for serious degradation diagnostics once every couple of minutes is enough). But logging is still a great tool.
- iamwil 10mo agoContent marketing and lead generation is getting more sneaky
- nostrademons 10mo agoGoogle solved most of these problems around 2005, with tools like LOG_EVERY_N (now part of absl [1]), Dapper [2], and several other tools that aren't public yet. You can trace an individual request through every internal system, view the request/response protobufs, every log that the server emitted, timing details, etc. More to the point, you can share this trace, which means that it's possible for one person to discover the bug, reproduce it, and then have another person in a completely different office/timezone/country debug it, even if the latter cannot reproduce the bug themselves. This has proved hugely useful; just last week I was tasked with reproducing a bug on sparsely-available prerelease hardware so that a distant team could diagnose what went wrong. The key insight that this article hints at but doesn't quite get too: you should treat your logs as a product whose customers are the rest of the devs in your company. The way you log things is intimately connected with what you want to do with them, and you need to build systems to generate useful insights from the log statements. In some cases it literally is part of the product: many of the machine learning systems that generate recommendations, search results, spam filtering, abuse detection, traffic direction, etc. are all based on the logs for the product, and you need to consider them as first-class citizens that you absolutely cannot break while adding new features. Logs are not just for debugging. [1] https://absl.readthedocs.io/en/latest/absl.logging.html https://absl.readthedocs.io/en/latest/absl.logging.html [2] https://research.google/pubs/dapper-a-large-scale-distributed-systems-tracing-infrastructure/ https://research.google/pubs/dapper-a-large-scale-distribute...
- jwpapi 10mo agoYou get: "Show me all checkout failures for premium users in the last hour where the new checkout flow was enabled, grouped by error code." I can do this with axiom already and I’ve never worried about how to log.
- aidenn0 10mo agoI prefer narrow entries with an "event ID" attached; you can trivially filter to get all of your items with the same event ID, but it works better with all the tools designed for narrow entries. So instead of one entry with e.g. 27 elements, you have maybe a dozen entries, all with the same event id and 2-4 elements (including the event ID) each. This also lets you log incrementally; if your server crashes before you log the wide entry you have zero data. It also lets you adjust the granularity. E.g. for a web service you might have both a session and a request ID.
- amai 10mo agoThe author wrote about the topic before: https://boristane.com/blog/observability-wide-events-101/ https://boristane.com/blog/observability-wide-events-101/ He used to work for https://baselime.io/ https://baselime.io/ which was aquired by Cloudflare.
- valyala 10mo agoNice article about the usefulness of wide events! It's pity it doesn't name open-source solutions optimized for wide events such as VictoriaLogs.
- theflyerkid2023 10mo agoHacking Instagram account
- killme2008 10mo agoThis thread overlaps a lot with "Observability 2.0 and the Database for It" (https://news.ycombinator.com/item?id=43789625 https://news.ycombinator.com/item?id=43789625). The core claim there is: treat logs/spans as structured "wide events", and build a storage/query layer that can handle high-cardinality events so many metrics become derived views rather than pre-modeled upfront. It also argues the hard part isn't "dump it in S3", it’s indexing/queryability + cost control at scale. In an agentic AI world this pressure gets worse: telemetry becomes more JSON-ish, more high-cardinality (tool names, model/version, prompt/template IDs, step graphs), and more bursty, so pre-modeling every metric up front breaks down faster.