Frontend health endpoint logs excessive noise in Kubernetes

Open Beginner friendly
#7,080 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
javascript, kubernetes
Domain
devops, frontend

Research direction

Start in frontend/api/index.js at the /health handler and inspect how its direct console.log produces output for every request. Remove the default health-check log or gate it as described, then verify that /health still returns OK without emitting the unwanted line by default.

Written by the indexing model from the issue text.

Description

Problem

The frontend health endpoint (/health) in frontend/api/index.js contains a hardcoded console.log('Healthcheck complete') on every request:

app.get('/health', (req, res) => {
  console.log('Healthcheck complete')
  res.send('OK')
})

In Kubernetes, liveness and readiness probes hit /health every 10 seconds per pod. This generates a constant stream of Healthcheck complete log lines that:

  • Increases log storage/ingestion costs (e.g. CloudWatch, Datadog, Loki) — especially when running multiple replicas
  • Drowns out meaningful application logs, making it harder to debug real issues
  • Cannot be disabled via environment variables — ACCESS_LOG_LOCATION does not affect this since it's a direct console.log call

Expected Behavior

Health check requests should not produce log output by default, or there should be an environment variable (e.g. LOG_HEALTHCHECK=false) to suppress it.

Suggested Fix

Remove the console.log from the health endpoint, or gate it behind an environment variable:

app.get('/health', (req, res) => {
  if (process.env.LOG_HEALTHCHECK === 'true') {
    console.log('Healthcheck complete')
  }
  res.send('OK')
})
Dominant language
Python
Stars
6.6k
Forks
571
Avg merge
1d 16h
Merged PRs (30d)
116

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Flagsmith/flagsmith

All issues in Flagsmith/flagsmith

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.