Repository navigation
v0.3.0
Restarting httpdog no longer loses log lines, and sudo httpdog -t checks the rule file the way nginx -t checks nginx's configuration. The first of these changes how httpdog is installed under systemd: there are now two unit files, and an existing install has to be upgraded by hand, see "Two unit files in place of one" below.
Added
httpdog -tchecks the rule file the waynginx -tchecks nginx's configuration.-tis--checkunder a shorter name, with two things that makesudo httpdog -tenough on an installed host. Without--configit checks/etc/httpdog/rules.yaml. And a variable the rule file refers to that is not in the environment is looked up in/etc/httpdog/secrets.env, read the way systemd reads it, so the check no longer ends inenvironment variable ... is not setfor lack of the webhook URL and secret. The answer names the file:OK: /etc/httpdog/rules.yaml: 4 rule(s).
Fixed
- A restart of httpdog lost one log line for every nginx worker, and every line sent while it was down. httpdog created its socket itself, so each restart made a new one: nginx's workers were still connected to the old one, and each found out by losing its next line. Unless nginx was reloaded right after, a probe that happened to be a worker's first request after the restart raised no alert. Now systemd creates the socket and holds it (
deploy/httpdog.socket), and passes it to httpdog at every start. A restart keeps the same socket, nginx needs no reload, and the lines sent in the meantime wait in the socket until httpdog is back: a few hundred fit, 512 at most. This coverssystemctl restart, a crash, the watchdog and the memory ceiling.
Changed
-
Two unit files in place of one.
deploy/httpdog.socketis new and describes the socket: its path, its mode (0660) and its group.deploy/httpdog.serviceno longer creates the directory or hands the socket to the web server's group, and needshttpdog.socket. Who can send logs is unchanged, root and the web server's group, and httpdog is still not a member of that group; it now cannot remove or replace the socket file either, which belongs to root. To upgrade an install of 0.2.x:sudo systemctl stop httpdog # While the old unit file is still loaded: it removes the old socket # Install the new binary (step 1 of the README), fetch the two unit files (step 2), then: sudo install -m 644 httpdog.service httpdog.socket /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable --now httpdog # Enables and starts httpdog.socket too sudo systemctl reload nginx # One last time
The new binary also runs under the old unit file, behaving as before. The new unit files need the new binary: an older one fails with
a socket is already there and cannot be checked. -
The group is set in
httpdog.socket. If you changedwww-datainhttpdog.service(tonginxon Fedora or Rocky Linux), make the same change toSocketGroup=inhttpdog.socket. -
With a
listenother than the default, the address goes inhttpdog.socketas well. httpdog checks that the socket systemd passed is the onelistennames and does not start when they differ (exit status 78), because it would otherwise run and receive nothing. For UDP, writeListenDatagram=127.0.0.1:5514inhttpdog.socket. With the default socket there is nothing to do. For the same reason a reload refuses a rule file whoselistendiffers from the socket systemd holds, and keeps the old rules: taking it would leave a rule file that works until the next restart or reboot and then keeps httpdog down. -
Stopping httpdog alone does not keep it stopped. The socket stays with systemd, and the next log line starts httpdog again. Use
sudo systemctl stop httpdog.socket httpdog. -
After a rule file error at startup (exit status 78), systemd tries a few more times when a log line arrives and then stops
httpdog.sockettoo. Fix the file, thensudo systemctl start httpdog && sudo systemctl reload nginx. -
httpdog started without systemd, or without
httpdog.socket, creates its socket itself as before. -
--checkwithout--confignow checks/etc/httpdog/rules.yaml, where it used to check./rules.yaml, and its answer starts with the name of the file. Running httpdog without--configstill uses./rules.yaml. -
A new dependency,
sd-listen-fds(142 lines, no dependencies of its own), takes the socket systemd passes. That step needsunsafein Rust, which httpdog's own code still forbids. -
Every release also carries its build provenance as
httpdog.intoto.jsonl, the same content ashttpdog.sigstore.jsonunder the name OpenSSF Scorecard looks for. The file was added to the five releases already published; their binaries and other files are unchanged.
Documentation
- The README starts with the install, and the install is one path from the download to a first alert: it now includes connecting nginx (the snippet goes into
/etc/nginx/conf.d/), a placeholder for whoever has no receiver yet, and reading httpdog's log. The "Try it first" section is gone; replaying the sample log to test a receiver is indocs/webhook.md. - New in the README and
docs/log-format.md: aserver { }block with anaccess_logline of its own does not use the one for httpdog, and needs the line as well. - The README and
docs/webhook.mdpoint to httpdog-house, a separate project that receives httpdog's webhook alerts, verifies them, and keeps them searchable on web pages, on your own Cloudflare account. The README shows a screenshot of its alerts page, in the reader's light or dark theme.