Log by time, not by count
91–100 of 109 posts
Re: Log by time, not by count
#92Best advice I ever got on logging: log all major logical branches within code (if/for) if "request" span multiple machine in cloud infrastructure, include request ID in all so logs can be grouped if possible make log level dynamically controlled, so grug can turn on/off when need debug issue (many!) if possible make log level per user, so can debug specific user issue - https://grugbrain.dev/ The only one I'll add is…
log all major logical branches within code (if/for)
This certainly does not work for any non-trivial amount of load...Re: Log by time, not by count
#93I agree with this. Logging, as well as metrics and tracing, are such hard topics for me to wrap my head around though. From the log consumer (person) perspective, you'd want logs to provide you with sufficient information when troubleshooting. But since trouble usually happens when things go wrong in unexpected ways, the logging likely won't be well aligned to emit the right info for you to figure out what's going wr…
Everything is events. The problem is that, as you notice, you frequently encounter situations where there are too many events to handle. Metrics, logging, and tracing are just three different ways to handle that problem. Metrics handles too many events by aggregating them. You handle too many events by squashing them into a smaller number of events that aggregate the information. Logging handles too many events by sa…
Somewhat formalized: https://peter.bourgon.org/blog/2018/08/22/observability-sign...
Re: Log by time, not by count
#94Best advice I ever got on logging: log all major logical branches within code (if/for) if "request" span multiple machine in cloud infrastructure, include request ID in all so logs can be grouped if possible make log level dynamically controlled, so grug can turn on/off when need debug issue (many!) if possible make log level per user, so can debug specific user issue - https://grugbrain.dev/ The only one I'll add is…
log all major logical branches within code (if/for) This certainly does not work for any non-trivial amount of load...
Re: Log by time, not by count
#95One way to reframe this is: "as a user [of the logs], what might I want to know?" In my experience, this post is often right (and the logs are often wrong). There's a tendency to either log too much or log too little - if only a few items are getting processed, it's fine and maybe even good to log all 7 of them. But if many, many are getting processed - you'll experience semantic overload as a reader of the logs. Wha…
Re: Log by time, not by count
#96Earlier quoted context omitted.
log all major logical branches within code (if/for) This certainly does not work for any non-trivial amount of load...
My systems scale to somewhere around 200,000+ machines at peak and seem to do fine.
Re: Log by time, not by count
#97There is an additional benefit to throttling by time, it is a lot easier to do it efficiently in multithreaded environments. If you log by count, you need a global counter for that event (you could do thread-local, but then your logging volume would depend on the number of threads). If the code path is hot (which may be the case if you want to throttle your logs) multiple threads will contend on the increment, and th…
Re: Log by time, not by count
#98Re: Log by time, not by count
#99> Log rate should be consistent If you want to know if an application is running, implement health checks. I hope I never have to deal with the pattern suggested in this article in a production system.
Re: Log by time, not by count
#100Earlier quoted context omitted.
log all major logical branches within code (if/for) This certainly does not work for any non-trivial amount of load...
My systems scale to somewhere around 200,000+ machines at peak and seem to do fine.