<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/our-health-check-reported-clean-logs-it-had-not-read-a-single-line--nedhq8fv8" -->

---
title: Our health check reported clean logs. It had not read a...
description: A health check that reported clean logs and zero errors was silently broken in two separate ways. First, a live docker service logs pipe into tail never...
canonical: https://daily.dev/posts/our-health-check-reported-clean-logs-it-had-not-read-a-single-line--nedhq8fv8
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Our health check reported clean logs. It had not read a single line. | daily.dev
og:description: A health check that reported clean logs and zero errors was silently broken in two separate ways. First, a live docker service logs pipe into tail never...
og:url: https://daily.dev/posts/our-health-check-reported-clean-logs-it-had-not-read-a-single-line--nedhq8fv8
og:image: https://api.daily.dev/og/posts/nedHq8fv8.png
og:image:alt: Our health check reported clean logs. It had not read a single line.
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Our health check reported clean logs. It had not read a single line.

**[AlphAI](https://daily.dev/sources/alphai)** · [@mikhailmakeev](https://daily.dev/mikhailmakeev) · 2 min read · 0 upvotes · 0 comments

## Summary

A health check that reported clean logs and zero errors was silently broken in two separate ways. First, a live docker service logs pipe into tail never terminated because docker logs doesn't send EOF across task restarts, and a timeout wrapper failed silently on macOS (no timeout command), causing grep to count only the error output as if it were the whole log. Second, a perl-based alarm() timeout appeared to fix this but didn't actually cap anything because the docker CLI is a Go binary and the Go runtime ignores SIGALRM, so the alarm only worked in test windows that would have ended on their own anyway. The fix: capture logs to a file in a background process guarded by a kill -TERM watchdog, grep the file rather than a live pipe, print the line count first, mark truncated output as [CAPPED], and exit non-zero on empty captures or docker command failures. This was the third time 'not measured' had been silently reported as 'healthy'.

## Content

A deep smoke-test run last week came back with "django-server: 1 line in 24 hours, 0 errors". A minute earlier the same run had pushed a live Stripe checkout and a signed webhook delivery through that service. Both of them had to be in that log.

Two separate failures, and both fail silently toward "clean".

The recipe was `docker service logs ... | grep ... | tail -20`. `docker service logs` never sends EOF on a window that crosses a task restart, so a live pipe ending in `tail` waits forever. I knew that, so I wrapped it in `timeout 45 ...`. macOS has no `timeout`. The command died with `command not found`, `grep -c` counted that single line of error output, and the check reported "1 line, 0 errors". The real volume was 6,010 lines an hour.

Then my fix was wrong in a more interesting way. I capped the run with `perl -e 'alarm N; exec @ARGV'`. Perl is on both machines and the alarm survives the exec. The tests passed. They passed because every window I tested closed by itself. On a 24-hour window it hung exactly like the original.

```

kill -ALRM <docker pid> -> ALIVE

kill -TERM <docker pid> -> died

```

The docker CLI is a Go binary, and the Go runtime ignores SIGALRM. My limiter was limiting nothing and it "worked" only on the windows that needed no limiter.

What the helper does now: the capture runs as a background process with a `kill -TERM` watchdog, it writes to a file and greps the file instead of a live pipe, it prints the line count first, it marks the output `[CAPPED]` when the window was cut short, and it exits non-zero on an empty capture or on any docker refusal (wrong context, no such service, permission denied).

That last one is the actual bug class. This was the third time since July that "not measured" got printed as "healthy", and the two earlier ones I fixed with a note to myself instead of a tool.

## Similar posts on daily.dev

- [My Health Check Watched the Wrong File](https://daily.dev/posts/my-health-check-watched-the-wrong-file-2b3dvjvdj) · DEV · 1 upvotes · 0 comments
- [Docker containers can fail without crashing, and this one setting catches them before your users do](https://daily.dev/posts/docker-containers-can-fail-without-crashing-and-this-one-setting-catches-them-before-your-users-do-wwdzxdvqm) · XDA Developers · 0 upvotes · 0 comments
- [The Healthcheck Was Green. The Process Inside Had Been Dead for 19 Minutes](https://daily.dev/posts/the-healthcheck-was-green-the-process-inside-had-been-dead-for-19-minutes-gsse9ynae) · Medium · 0 upvotes · 0 comments
- [Healthchecks with distroless containers](https://daily.dev/posts/healthchecks-with-distroless-containers-pkml61f20) · ITNEXT · 1 upvotes · 0 comments
- [I added health checks to every Docker container, and now my homelab restarts its own broken services](https://daily.dev/posts/i-added-health-checks-to-every-docker-container-and-now-my-homelab-restarts-its-own-broken-services-arhxzw6yt) · XDA Developers · 0 upvotes · 0 comments

---

Tags: [#golang](https://daily.dev/tags/golang), [#docker](https://daily.dev/tags/docker), [#observability](https://daily.dev/tags/observability)

[View this post on daily.dev](https://daily.dev/posts/our-health-check-reported-clean-logs-it-had-not-read-a-single-line--nedhq8fv8)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/our-health-check-reported-clean-logs-it-had-not-read-a-single-line--nedhq8fv8","headline":"Our health check reported clean logs. It had not read a single line.","text":"A health check that reported clean logs and zero errors was silently broken in two separate ways. First, a live docker service logs pipe into tail never terminated because docker logs doesn't send EOF across task restarts, and a timeout wrapper failed silently on macOS (no timeout command), causing grep to count only the error output as if it were the whole log. Second, a perl-based alarm() timeout appeared to fix this but didn't actually cap anything because the docker CLI is a Go binary and the Go runtime ignores SIGALRM, so the alarm only worked in test windows that would have ended on their own anyway. The fix: capture logs to a file in a background process guarded by a kill -TERM watchdog, grep the file rather than a live pipe, print the line count first, mark truncated output as [CAPPED], and exit non-zero on empty captures or docker command failures. This was the third time 'not measured' had been silently reported as 'healthy'.","url":"https://daily.dev/posts/our-health-check-reported-clean-logs-it-had-not-read-a-single-line--nedhq8fv8","datePublished":"2026-09-07T06:30:23.886Z","dateModified":"2026-09-13T05:18:28.822Z","author":{"@type":"Person","name":"Mikhail Makeev","url":"https://daily.dev/mikhailmakeev","image":"https://lh3.googleusercontent.com/a/ACg8ocIjcvDU1gmJ9-KJDeTYqY2rMdl5QxcWYtLTGSXrj8ubF4nwar_w=s96-c","description":"Owner of alphai.io","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":5200}},"image":"https://media.daily.dev/image/upload/s--rnJr6Q1K--/f_auto/v1789276708/posts/nedHq8fv8?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/alphai","name":"AlphAI"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"AlphAI","item":"https://daily.dev/squads/alphai"},{"@type":"ListItem","position":3,"name":"Our health check reported clean logs. It had not read a single line."}]}
```

