Let’s beryllium honest: Most logs are conscionable noise.
As developers, we excessively often sprinkle logs for illustration confetti — each usability entry, each variable, each heartbeat. Before long, terabytes of meaningless lines heap up, filling dashboards nary 1 reads.
We salary millions of dollars to observability vendors conscionable to storage our junk. Every useless log statement burns compute, disk and dollars. Logging without intent isn’t observability, it’s littering.
Even pinch modern observability platforms that dramatically summation compression done columnar storage, there’s nary logic to log everything. It still turns guidelines origin study into a needle-in-a-haystack problem, diluting nan awesome you really request — and you’ll salary much for nan privilege.
We request to beryllium selective. Log what helps america understand nan system, debug existent issues aliases explicate business effect — and unopen everything other up.
The Philosophy of a Log Line
Every log statement is simply a choice, not a reflex. If it’s not helping your early aforesaid way down a bug astatine 3 a.m., delete it. Logging isn’t journaling; support it minimal, clear and really useful.
Before you deed logger.info, stop, and ask: Would I really grep this?
If not, delete it. Logs aren’t narration; they’re evidence. They beryllium to show you what nan strategy was reasoning erstwhile things went wrong.
Logs shouldn’t beryllium relegated to nan extremity of nan observability chain. They’re not conscionable a microscope for confirmation but a representation for discovery. Sometimes nan quickest measurement to penetration is to research earthy matter _ grep, select and travel intuition.
Logs induce curiosity — they uncover nuance that metrics mightiness soft complete and discourse that traces can’t express. Treat them not arsenic nan last edifice but arsenic a surviving root of truth, unfastened to exploration from nan very start.
Context aliases It Didn’t Happen
“Error occurred” without inputs, IDs aliases authorities intends nothing. Add capable discourse to reconstruct nan infinitesimal — petition IDs, personification IDs, input parameters, cognition names. These days, pinch OpenTelemetry, you get trace and span IDs for free. Use them. Logs connected to traces (and moreover metrics) by trace IDs are infinitely much valuable than isolated lines of text.
Logs aren’t a standalone pillar; they’re nan closing section of your guidelines origin analysis. You alert connected metrics, analyse done traces and past driblet into logs to spot what really happened. When your logs are linked by trace and span IDs, they extremity being sound and commencement being grounds — tightly scoped, contextual and straight tied to nan way of a azygous request. That’s observability pinch intent, not a wall of text.
Well-Structured, Not Free Text
Free-text logging is obsolete. Structured logs, whether JSON, CSV aliases key-value, aren’t conscionable easier to query; they’re nan instauration for analytics. Once logs person structure, patterns emerge:
- “This correction started spiking past week.”
- “This happens mostly aft arena X.”
- “This informing correlates pinch this circumstantial deployment.”
The early of logging isn’t reference 1 line; it’s seeing nan shape crossed thousands.

Structured logging makes charting easy and efficient.
While galore observability platforms connection schema connected read, that elasticity comes astatine a cost. Every query forces nan strategy to scan and parse earthy text, statement by line, to infer a building that should person existed successful nan first place. These queries are computationally expensive, slower and much difficult for a personification to write.
Prestructured logs flip that inefficiency connected its head. When your information already has shape, you tin return advantage of column-oriented retention and autochthonal aggregation — querying, visualizing and correlating events successful milliseconds alternatively of minutes.
Know When To Measure, Not Just When To Log
Not each event belongs successful nan log stream. Some things merit building and timing — precisely what spans and metrics are for. If you’re measuring latency, personification travel aliases distributed causality, emit a span instead. Spans seizure duration, discourse and relationships crossed services and show you why thing was slow aliases broken, wherever a log tin only outcry that it happened.
The aforesaid logic applies to metrics, turning repetitive logs into existent signals you tin alert connected and aggregate efficiently. If you find yourself logging nan aforesaid connection hundreds of times per second, you’re not observing, you’re conscionable wasting storage. Measure it once, summarize it, and fto your metrics and traces do nan dense lifting.
Log Levels Are For Humans, Not Machines
Logging isn’t a individual debugging diary; it’s a shared artifact for your early teammates. Every statement should thief personification understand what happened without guessing what you meant. Write logs for nan adjacent incident, not your existent mood. Your logs show nan communicative of your system. Make it 1 worthy reading, for example:
- ERROR: Page a human. Something’s broken.
- WARN: Unexpected but survivable. Investigate later.
- INFO: Routine strategy behaviour worthy knowing.
- DEBUG/TRACE: Temporary developer penetration — should seldom time off your laptop.
Be deliberate. Don’t people thing arsenic an correction unless it genuinely requires action. Overusing ERROR numbs your alerts and trains teams to disregard what matters. Every log level should pass intent: what needs fixing now, what needs watching and what tin beryllium ignored.
That said, trace logging has its place. For example, down nan scenes for ClickHouse Cloud, we trace-log extensively to thief our engineers diagnose capacity issues and support customers astatine scale. It’s a deliberate objection — basal erstwhile you run a distributed database serving thousands of workloads successful existent time. For astir applications, though, this level of verbosity isn’t observability; it’s conscionable noise.
Tools To Help You Log Less and Log Smarter
Rich SDKs and powerful filters beryllium truthful you don’t person to conscionable “log everything.” Use them.
Modern OpenTelemetry Collector SDKs fto you beryllium prescriptive astir what you log: You tin instrumentality your codification truthful that only meaningful log lines are created, and you tin select aliases driblet everything other astatine ingest aliases postulation time.
For example:
- The select processor supports dropping unwanted logs, metrics aliases traces utilizing nan OpenTelemetry Transformation Language (OTTL) with conditions for illustration severity, assets attributes aliases contented patterns.
- If your observability level allows, you tin filter astatine supplier time, collector gateway aliases ingest clip truthful unnecessary logs ne'er get written, stored aliases indexed (saving you compute, retention and query cost).
If administrators spot users generating frivolous logs, they tin aggressively select them, either successful nan pipeline aliases by forcing minimal logging policies. If you’re utilizing a proprietary platform, these supply akin filtering aliases ingestion-control tools, moreover if they don’t outcry astir them publicly.
Log With Purpose, aliases Don’t Log astatine All
Observability isn’t astir volume. It’s astir clarity. Every log statement should gain its spot by explaining thing that metrics and traces can’t. Logging without intent conscionable burns money and buries insight.
Be deliberate. Use structure. Add context. Know erstwhile to measure, erstwhile to trace and erstwhile to opportunity nothing. Modern devices make it easier than ever to beryllium disciplined, but nan subject still has to travel from you.
In nan end, awesome logging isn’t astir capturing everything that happens. It’s astir capturing what matters.
YOUTUBE.COM/THENEWSTACK
Tech moves fast, don't miss an episode. Subscribe to our YouTube channel to watercourse each our podcasts, interviews, demos, and more.
Group Created pinch Sketch.
English (US) ·
Indonesian (ID) ·