<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lean Team</title>
    <description>The latest articles on DEV Community by Lean Team (@lean-team-products).</description>
    <link>https://dev.to/lean-team-products</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4256191%2F9037f90d-bcdd-4d5f-944f-3cfc3e89d679.png</url>
      <title>DEV Community: Lean Team</title>
      <link>https://dev.to/lean-team-products</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lean-team-products"/>
    <language>en</language>
    <item>
      <title>One stack trace, 40 billed log entries: the logging cost most teams miss</title>
      <dc:creator>Lean Team</dc:creator>
      <pubDate>Fri, 20 Nov 2026 20:29:55 +0000</pubDate>
      <link>https://dev.to/lean-team-products/one-stack-trace-40-billed-log-entries-the-logging-cost-most-teams-miss-2b0l</link>
      <guid>https://dev.to/lean-team-products/one-stack-trace-40-billed-log-entries-the-logging-cost-most-teams-miss-2b0l</guid>
      <description>&lt;p&gt;Most log platforms treat &lt;strong&gt;each line of stdout as a separate log entry&lt;/strong&gt;. So one plain-text Java stack trace arrives as 40 or more entries: each one billed, most with no level or timestamp, and impossible to search as a single error. Python tracebacks, Node errors and .NET exceptions have the same problem.&lt;/p&gt;

&lt;p&gt;It rarely shows up as a line item. It just makes the bill bigger and outages harder to debug.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to tell if it's happening to you
&lt;/h2&gt;

&lt;p&gt;Search your logs for entries that start with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;whitespace or a tab&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;at&lt;/code&gt; (Java and .NET frames)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Caused by:&lt;/code&gt; or &lt;code&gt;... N more&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Traceback (most recent call last)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Another sign: your platform reports far more "errors" than your application actually threw. If a single failed request produces dozens of error entries, you're paying for line splitting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 1 (best): structured logging
&lt;/h2&gt;

&lt;p&gt;Have the logger serialize the exception into one field of one JSON line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"ERROR"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"payment failed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="nl"&gt;"error.type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"java.net.SocketTimeoutException"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="nl"&gt;"error.stack"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"java.net.SocketTimeoutException: Read timed out\n\tat ..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="nl"&gt;"order_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"8812"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One error, one entry, fully searchable. It fixes levels, timestamps and request context at the same time. Every major language has a JSON encoder for its standard logger: Logback or Log4j2 for Java, pino or winston for Node, &lt;code&gt;python-json-logger&lt;/code&gt; or structlog for Python, Serilog for .NET.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 2 (stopgap): join the lines in the collector
&lt;/h2&gt;

&lt;p&gt;When you can't change the application yet, have the log shipper stitch multi-line events back together before they're sent. With Fluent Bit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="k"&gt;[FILTER]&lt;/span&gt;
    &lt;span class="nc"&gt;Name&lt;/span&gt;                  &lt;span class="n"&gt;multiline&lt;/span&gt;
    &lt;span class="nc"&gt;Match&lt;/span&gt;                 &lt;span class="n"&gt;kube&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;
    &lt;span class="n"&gt;multiline&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;key_content&lt;/span&gt; &lt;span class="n"&gt;log&lt;/span&gt;
    &lt;span class="n"&gt;multiline&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parser&lt;/span&gt;      &lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;go&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CloudWatch agent and Google's Ops Agent have equivalent multi-line settings. It's a stopgap because the joined entry is still unstructured text, but it stops the per-line billing today.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: AWS log groups that never expire
&lt;/h2&gt;

&lt;p&gt;While you're looking at logging costs: CloudWatch log groups &lt;strong&gt;never expire by default&lt;/strong&gt;. Any group nobody configured keeps growing forever. This lists every group with no retention set:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws logs describe-log-groups \
  --query &lt;span class="s1"&gt;'logGroups[?!retentionInDays].logGroupName'&lt;/span&gt; --output text
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then set one, for example 30 days:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws logs put-retention-policy --log-group-name &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;name&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --retention-in-days 30
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For comparison, Google Cloud's &lt;code&gt;_Default&lt;/code&gt; bucket keeps logs for 30 days unless you change it, and Azure Log Analytics defaults to 30 days for most tables.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Search for stack-trace fragments to see how much of your volume is split lines.&lt;/li&gt;
&lt;li&gt;Switch to JSON logging where you can.&lt;/li&gt;
&lt;li&gt;Join lines in the collector where you can't yet.&lt;/li&gt;
&lt;li&gt;Put a retention policy on every log group.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://www.leanteamproducts.com/blog/stack-traces-logging-cost" rel="noopener noreferrer"&gt;Lean Team blog&lt;/a&gt;. Free download: the &lt;a href="https://www.leanteamproducts.com/?checklist=1" rel="noopener noreferrer"&gt;Codebase Antipattern Checklist&lt;/a&gt;, 48 signs a codebase is getting harder to change.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>logging</category>
      <category>cloud</category>
      <category>sre</category>
    </item>
  </channel>
</rss>
