Flagsmith / Flagsmith/flagsmith

Frontend health endpoint logs excessive noise in Kubernetes

Open
#7,080 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
6.6k
Forks
567
Avg merge
1d 13h
Merged PRs (30d)
121

Description

## Problem

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

```js
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:

```js
app.get('/health', (req, res) => {
if (process.env.LOG_HEALTHCHECK === 'true') {
console.log('Healthcheck complete')
}
res.send('OK')
})
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.