Watch your servers
Keep your servers clean and lean
Servers collect things: debug switches, forgotten tools, Git folders, secrets in logs, room nobody uses. Kiyesi finds each, with its fix.
Open Clean and lean in the dashboard. It has four parts. It reads only what Kiyesi already has, so it costs nothing extra and needs no setup.
What you could save a month, from Costs: half the price of each server larger than it needs to be, and the whole price of each server that has been nearly idle for two weeks. Set each server’s monthly price on Costs to see it. On Mondays the morning brief says it too.
Left over from development
Section titled “Left over from development”The leftovers check runs in every scan, with the other checks, and finds:
| Finding | Why it matters |
|---|---|
| Debug mode on, in an env file or a running container, in any language (see below) | Error pages show visitors your code, settings and sometimes secrets |
| A development tool running in a container: phpMyAdmin, Adminer, MailHog, Mailpit, MailDev, pgAdmin, mongo-express, Redis Commander, RedisInsight | It gives whoever reaches it your data. Critical when its port is open beyond the server itself |
A Git folder in the web root, such as /var/www/shop/.git |
If it is served, anyone can download your whole code and its history. The grade from outside checks whether it is |
A log of 1 GB or more, in /var/log or a container’s own log with no size limit |
It fills the disk, and a full disk stops every app on the server |
| 2 GB or more that Docker keeps for nothing: images no container uses, and old build cache | Disk you pay for. It is information only and costs no points |
The debug and development switches it knows:
| Language | Switches |
|---|---|
| PHP | APP_DEBUG=true, APP_ENV=local or dev (Laravel, Symfony), SYMFONY_ENV=dev, WordPress’s WP_DEBUG |
| JavaScript and TypeScript | NODE_ENV=development |
| Python | FLASK_DEBUG=1, DJANGO_DEBUG=true, DEBUG=true |
| Ruby | RAILS_ENV=development, RACK_ENV=development |
| Go | GIN_MODE=debug |
| Java and Kotlin | SPRING_PROFILES_ACTIVE with dev or local among its profiles, QUARKUS_PROFILE=dev, MICRONAUT_ENVIRONMENTS with dev or local |
| Elixir | MIX_ENV=dev |
| C# and .NET | ASPNETCORE_ENVIRONMENT=Development, DOTNET_ENVIRONMENT=Development |
Env files named for development (.env.development, .env.local, .env.test, .env.example) are expected to have debug on and are left alone. Kiyesi reads only the values of these settings, never any other value in the file.
Docker’s space is one command away, for you to review and run:
sudo docker image prune -a --filter until=168h && sudo docker builder prune --filter until=168hIt removes images no container uses that were built over a week ago, and build cache over a week old. An image you replaced today also goes if it was built more than a week ago: to keep one for rolling back, tag it or start a container from it first. Containers and volumes are never touched: a stopped container or an unused volume can hold the only copy of your data. It cannot be undone, and Docker asks before it removes anything. See Fix what Kiyesi finds.
Secrets in your logs
Section titled “Secrets in your logs”When Kiyesi receives log lines it masks every password, token and key it recognises before storing them: Authorization: Bearer [masked]. Kiyesi never keeps them. But the app still writes them, so they sit in its own log files, in docker logs, and wherever else its logs go, readable by anyone who can read those.
Clean and lean lists each app that wrote a secret to its logs in the last 7 days, on which server, how many lines, since when, and one masked line it wrote so you can find the code. The first time an app does it, Kiyesi sends a Secret in logs alert to your channels, once.
To fix it, find where the app logs the request, its headers or its settings, and leave the secret out. Then change the secret: old log files still hold it.
The last day of your logs, four ways:
-
Worth a look: problems written over and over, such as an error a program keeps repeating. Each shows its newest line and opens in Logs. Every warning and error is looked at, however many busier lines there are, and none is ever offered to be left out: a repeated error is a problem to fix, not noise. Your web server’s request lines are offered only for health checks, as the others feed Addresses asked for most and the way from Logs to Traces.
-
Loudest sources: the containers, services and files that wrote the most lines and bytes, each with a bar for its share.
-
Lines written most often, with numbers taken out, so
GET /health 200 took 3 msandGET /health 200 took 4 mscount as one, each shown as its newest line was written. Tick the ones you would rather not send, and the setting for/etc/kiyesi/config.yamlgathers them in one place to copy:logs:drop:- "GET /health"Lines that one text stops are shown together, with the servers they came from. A JSON line is matched by its own message, never by its first characters, which every line of that program shares. The agent reads it again within a minute, with no restart. Dropped lines never leave the server and never use your log allowance.
-
Addresses asked for most, from your web server’s lines, with ids in paths taken out (
/orders/<N>/pay), each with the server it was asked on. Kiyesi points out three kinds:When What to do Health check A health check address asked more often than every 15 seconds Every 30 seconds is enough Failing 5% or more of its answers are server errors, and at least 20 a day Whatever calls it keeps trying: find out why in Logs or Traces Busy Asked 20,000 times a day or more If a page or an app polls it, cache the answer or ask less often
Addresses come from your web server, or from the app itself when nothing is in front of it, in any language:
| From | Lines read |
|---|---|
| Web servers | nginx and Apache (the combined and common formats), Caddy |
| Go | Gin’s own lines; JSON loggers (zap, zerolog, slog, logrus, Echo) and logfmt that write method, path and status |
| JavaScript and TypeScript | pino-http (Express, NestJS), and JSON loggers as above. Fastify writes the address and the status on separate lines, so put a web server in front or log both on one line |
| Python | Uvicorn (FastAPI, Starlette), Gunicorn, and JSON loggers as above |
| Java and Kotlin | Tomcat’s and Spring Boot’s access log in the common format, once turned on (server.tomcat.accesslog.enabled=true) |
| Ruby | Rails with lograge |
| C# and .NET | ASP.NET Core’s own request lines |
When both the web server and the app log the same request, it is counted once, from the web server. Ids in addresses are taken out: whole numbers and long ids, so /v1/orders/42/pay and /v1/orders/43/pay count together. A request line is read when it arrives, so lines written before the agent started reading the log are not counted.
Who sees what
Section titled “Who sees what”Money needs View on costs. Leftovers need View on servers and findings. Secrets in logs and the noise need View on logs: they show lines. Each part shows only the servers and projects you may see.