Skip to content

Watch your servers

Several services on one server

One server often runs more than one thing: a shop and its admin, two clients’ sites, an API and a worker. Kiyesi tells them apart, so one service’s trouble is never blamed on another.

There is nothing to set up. From agent 0.36.0, Kiyesi finds two kinds of service:

  • Sites. Kiyesi reads nginx’s and Caddy’s logs and takes the site each request was for. Every access and error log in /var/log/nginx is read, not only access.log.
  • Containers. Each Docker container, by its name, with its own CPU and memory.

They appear on the server’s page, under Services on this server, within a few minutes of the agent seeing them.

A log line names its site in one of two ways:

  • the log format includes the site’s name: nginx’s vhost_combined format does, and Caddy’s log always does;
  • each site writes to its own log file, such as /var/log/nginx/shop.example.com.access.log.

Scanners and old domains send requests for names your server does not serve. A name counts as a site only once the server answers it. These do not count:

  • a name the server only redirects with 301 or 308, which is how Caddy and most nginx setups send a name they do not serve to https://;
  • a name the server only refuses, with 421 or 444;
  • the address in a CONNECT request: a scanner asking your server to pass its traffic on.

Their requests still count in the server’s totals, but not as a site. The usual source of such names is an old domain whose DNS, or Cloudflare, still points at your server’s address.

On the server’s page, when more than five sites had no requests in the last 5 minutes, they are folded into one line below the busy ones, with Show them. An agent older than 0.39.4 took every name in the log for a site, so its server may list hundreds of them. The page says so, and that sudo kiyesi update fixes it. Nothing is wrong with the server.

A site A container
Requests a minute, the share that failed with a server error (5xx), and the slowest 5% of answers (p95) Yes No: requests are counted for sites
CPU and memory No: a site has no CPU of its own; see its container Yes
Its own logs Yes, when the site writes its own log file Yes
Its own incidents When it answers with server errors, such as “shop.example.com on web-1 is answering with server errors” When it restarts again and again, is killed for using too much memory, or logs many errors in a few minutes
A deploy verdict on it alone When kiyesi deploy --app shop.example.com names the site When kiyesi deploy --app api names the container

So a busy, healthy site can no longer hide another site’s errors, and a deploy of one app is never told to roll back because of another. A container’s deploy is also judged on the requests to the sites it serves: Kiyesi reads which container serves which site from Traefik, Caddy and nginx, and you can change a link on the server’s page. See Which container serves which site.

In Metrics, choose a site to see its requests, errors and speed alone. CPU, memory and disk there stay the whole server’s.

A server belongs to one project. A site or container on it can belong to a different one: on the server’s page, choose Move to a project beside it. Its incidents and alerts then go to that project, so the people and alert channels of that project get them, and its monthly report includes them. Follow the server’s project puts it back.

Moving a service needs Manage on Servers and findings: the Owner and Admin roles have it, as does a role you made with it.

  • Its requests are in a log that names no site. Switch nginx to the vhost_combined format, or give each site its own access_log.
  • The agent is older than 0.36.0. Run sudo kiyesi update.
  • The site’s log file is new. The agent reads a new log file from the minute it first sees it, so the site appears with its next requests.

A service not seen for 7 days shows as Quiet. After 30 days it leaves the list.